-7

Ok, so I moved away from fat controllers. That's actually better. But now I have a fat model that I would like to split for better readability and easier maintenance. What is the recommended route ?

example from a current script :
1. initiate $ctrl
2. initiate $dbmodel

  • $ctrl->parser class , parsing data (using $element objects). All db calls are made to global $dbmodel
  • $ctrl->matchmaker class, matching content with targets. All db calls are made idem
  • $ctrl->mailer class, idem.

The $dbmodel is now way bigger than I like. Is there a proper/recommended way to split

Malaiac
  • 1
  • 1
  • 1

1 Answers1

0

Perhaps read up on clean architecture?

https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html

Specifically, one could create a service layer that is wrapped on your model layer.

The service layer will mutate the entities and have your domain business logic in that layer, or non-domain business logic.

That is the best I can answer your poorly written question.