Answer the question
In order to leave comments, you need to log in
Where to put business logic in Zend2+Doctrine2?
Hi friends!
I'm still new to zend2, and of course, I immediately decided to do everything the right way and connected Doctrine2. And so now it is not clear to me where to take out the logic? I used CakePHP before and everything is clear there.
If everything is clear with simple models, the logic can be stored right there, then what if you use Doctrine2? I mean the concept of thin controllers and thick models.
Example:
User registration. We have a UserController controller with registerAction. There is already a form itself and an entity User with getters and setters. For good, in the controller, you need to call a method like createUser (), and write this method somewhere in the model. Then it is more convenient to write unit tests by testing only the methods themselves in the model. But I was told that it is bad practice to shove this thing into Entity. So, where should I write it? Interested in best practice. Thank you in advance!
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question