On Wednesday 23 Feb 2011 17:09:24 Serkan Temizel wrote: > Hi zenders, > > > After a question about sending mail from controller or model (it is > here<http://zend-framework-community.634137.n4.nabble.com/send-mail-notices > -from-the-controller-or-model-td3319085.html>*) I got some unexpected > answers. Jurian mentioned about a service approach. After this post I > made some search about services and found this > article<http://www.angryobjects.com/2009/03/30/writing-robust-php-backends- > with-zend-framework/>** > > > Leendert Brouwer's article was on something totally new for me. Because it > was adding a new layer to MVC, a service layer. domain objects and mappers > are also new to me. > > I searched the web for documents about this new concept but I found nearly > no helpful resource. > > I need some valuable resource and coding and structuring samples about this > approach. > > More importantly I need your opinions about this approach. Why ZF don't > ship with a service layer or default mapper? Are they really needed or > they just increase the complexity? > > > --- > > * > http://zend-framework-community.634137.n4.nabble.com/send-mail-notices-from > -the-controller-or-model-td3319085.html ** > http://www.angryobjects.com/2009/03/30/writing-robust-php-backends-with-zen > d-framework/
I probably get a nice reply from Simon again with this message, but that's fine for me. As far as I know, you can strictly divide the system in a Model, Controller and View part. The fact action controllers get accompanied with a front controller and the views and layouts are split, does not change anything about MVC. That's also with the model part, where the models are broader than the single *_Model_* namespace. This is what I meant with the correction of Simon's post, because most times inexperienced users think the models are always and only in the *_Model_* namespace. In the Zend Framework, the big parts of the model is up to the user and not well defined. You can use Zend_Db_Table, but for example also ActiveRecords patterns like Doctrine1 or the EntityManager from Doctrine2. Or even completely other structures. And the *_Service_* namespace is afaik also considered as a Model part from MVC. So when I have a function which accepts a few parameters for a domain object to persist it into the database, I'd consider it to put this into the model layer, but in the Zend's *_Service_* namespace. Otherwise, your domain objects get completely cluttered with other tasks. If someone can add more, please do so :) Regards, Jurian -- Jurian Sluiman Soflomo - http://soflomo.com
