nilportugues / eloquent-repository Goto Github PK
View Code? Open in Web Editor NEWEloquent Repository implementation
Home Page: http://nilportugues.com
License: MIT License
Eloquent Repository implementation
Home Page: http://nilportugues.com
License: MIT License
Trait to do hydration a breeze
in example/Service/UserAdapter.php, line 16
The parameter
model
, which is an object, should be typehinted.
/**
* @param $model
*
* @return User
*/
public function fromEloquent($model)
{
return new User(
new UserId($model->id),
$model->name,
new DateTimeImmutable($model->created_at)
Posted from SensioLabsInsight
Buenas, he visto el repositorio y estoy haciendo unas pruebas, la duda que tengo es para hacer la siguiente consulta:
select count(id) from table where id = value and other_field = 'value2';
He seguido la estructura del filter, que sería así:
$filters = new Filter();
$filters->must()->equal('id', value);
$filters->must()->equal('other_field', 'value2');
total = parent::count($filters);
mi duda está en que el processCondition peta en querer comprobar el valor si es array
if (count($value[0]) > 1) { $where = static::filterRanges.......... } else { $where = static::filterGroup.......... }
Cuando realmente no quiero que entre en rango, ni en grupo, pero los filtros, siempre los trata como array.
Cual puede ser la solución.
Gracias
Was implemented in InMemoryRepository but not here
Hi, this package looks great, well done (y).
How would you approach a nested query? say we have a user with posts and I'd like to get the user with the latest 3 posts titles.
Do you just use laravel's validation? the problem is you'll be using the query builder when you do this and this kind of kills the abstraction layer a repository is supposed to provide.
Sorry if these questions are kind of off topic, they're just one of the reasons the repository pattern never seemed to work for me with eloquent, you always find yourself rewriting every cool feature of Laravel!
Break down everything into smaller chunks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.