Let’s suppose I want to log every model change (create, update, delete).
As for me, the most convenient place for this is the model itself (attached behavior, for example).
But the time passes by, and now I want to send a notification email to project’s team (“Hey, look, something has changed!”).
Seems like putting mail sender into model isn’t good decision (model sending emails? wtf?), especially if sending email involves template rendering (everybody loves pretty-looking emails).
So what do you think? how this should be designed?
Did you ever sort this problem out? I am looking at a situation where information is being brought into the db outside of Yii and I need to send emails based on certain data conditions.
Thought I could trigger an event on New Record insert…but calling the controller from the model seems backwards.
Likewise, sending email from the model seems a bit strange.