mercredi 29 juin 2016

PHP design patterns Factories

We make heavy use of the factory pattern, its create in situations where orchestrating the creation of entities (models) that have many different relationships and parameters. Great!

Although, I'm looking for a similar pattern for updating that same entity, is there one?

At present we update models in our Repositories as much of the Laravel community does. Although this to me is a code smell. Repositories are responsible for retrieving groups of entities, nothing more... Is there a term / pattern to cover this Creator / Factory paradigm?

To cut those Laravel fan boys down before they begin: Yes we are a large enough app to warrant these considerations. It has come to the point we need to split this logic away from our repositories...

Aucun commentaire:

Enregistrer un commentaire