In some special cases where just logging an error isn’t enough I would like to pass an error array or a custom error string from a Model to the calling Controller in order to send that data to me in an email.
I thought about just sending an email from the Model itself but I have read somewhere that it angers the MVC best practices gods. I looked around the CakePHP API and didn’t find anything that looks like what I need so I’m asking here to see if I missed anything.
Edit: I’m doing some special processing in the beforeSave() method.
Thanks!
Jason
Haha, going forward – in CakePHP 2.0 – the Email class will be a first-class citizen and not a component.
As such, I wouldn’t worry about angering the MVC gods by sending email from (god-forbid) models or shells or other useful places.
You do have to jump through a few hoops though: