On Tuesday 22 Feb 2011 14:07:26 Simon Walter wrote: > Fat model and skinny controller: > http://www.google.com/search?q=fat+model+skinny+controller > > I'm sure others will have a better reading resource for you. > > So make a "notification" model that handles notifications. If you need to, > you can add other types of notifications later. > > Don't do this kind of stuff directly in the controller.
It is a bad idea to reply to users with only the term "fat model skinny controller". Most inexperienced users will put their email functionality in the Application_Model_* entities which seems as incorrect as placing it inside controller to me. I suggest you create a service object which sends emails when required. The service class (Application_Service_*) is called by the controller and accepts models for message contents. For example, the Blog_ReactionController::addAction() calls Blog_Service_Email with a blog article and a reaction: Blog_Service_Email::sendEmail(Blog_Model_Article $blog, Blog_Model_Reaction $reaction). Regards, Jurian -- Jurian Sluiman Soflomo - http://soflomo.com
