I think Fluent is what you want.
Otherwise if you are trying to keep away from Eloquents tendency to want to do everything I recommend implementing the datamapper pattern. You could use doctrine which seems to be a proven way to do it but its a bit of a learning curve. Theres two laravel packages that help you integrate with it.
I'm trying out manually using the datamapper pattern in a project of mine. Each repository uses fluent to retrieve the entities data. I then map the returned collection with a factory that turns each stdObject to an entity object. The entity object is just a popo with a constructor, some getters and setters and some behavior methods. From a system perspective its working amazingly but theres a bit of boilerplate code involved that slows down development. Maybe as I get further into my project I'll be able to abstract out a nice little library for others to use.
yes Im trying to create a factory that will generate an entity object, and it could be created with eloquent or doctorine or anything else.
Im looking for this kind of factory that will get data and will create the entity object.
If you are looking for a package that just returns generic Entity classes (without mapping) you might be interested in my package: https://github.com/stidges/laravel-db-normalizer
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community