On Tuesday, February 22, 2011, Serkan Temizel wrote: > I'm share the same idea that a notificaion class (a model) is needed. The > question is where to call the methods of this class? > > Application_Model_Notifier::sendMail($args); > > Where to put this? in controller or model? >
It depends on your application. Essentially the controller/action is where the HTTP requests are processed. If you keep it to that minimum, your application will be easier to maintain. So perhaps you should put that call as close to the "event" that triggers the "notification" Don't be afraid of making many models. I usually try not to access Application_Model_DbTable_* models directly from the controller. In the same way I would not access Application_Model_Notification directly from the controller. I would at least make one more model(Application_Model_Comment) that would take care of a lot of stuff for me. There are many things to consider. For example: which users get notified, what is in the notification, etc. When looking at this, you may want even more models.
