Where should the business logic be placed when using Doctrine 2 and Zend Framework

Lypeirrerne

New Member
I've a question related to Doctrine 2 and Zend Framework.If you use Zend Framework without Doctrine by default you place business logic in the models. But as Doctrine 2 does have Entities where should the business logic be placed?I first had created models where the entity manager did calls to the Entities. But when I wanted to write unit tests for my models without database calls. I needed to move the entity manager to the controllers. But I'm getting business logic in my controllers which is not good.The code below shows a part of an controller action:\[code\] $customerAddress = $this->_model->save($values, $id); $this->_em->persist($customerAddress); // Update default billing address $defaultBilling = $this->_model->saveDefaultBilling($values, $customerAddress); if ($defaultBilling != FALSE) { $this->_em->persist($defaultBilling); } // Update default shipping address $defaultShipping = $this->_model->saveDefaultShipping($values, $customerAddress); if ($defaultShipping != FALSE) { $this->_em->persist($defaultShipping); } $this->_em->flush();\[/code\]Can somebody say what's the best practice for this issue? Thx
 
Back
Top