Support the ongoing development of Laravel.io →
Eloquent Packages Architecture
Last updated 1 year ago.
0

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.

Last updated 1 year ago.
0

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.

Last updated 1 year ago.
0

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

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

tzookb tzookb Joined 9 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.