Thanks for the helpful responses. The flexibility of using observers
does appear to offer the most functionality.

On Feb 2, 2:41 am, "ianh" <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> Fully agree that the way to use model callbacks for things like
> sending emails is to use observers - there is a tutorial on the Bakery
> on this. It is such a flexible way of doing things that I have started
> to put quite a lot of business logic that might otherwise go elsewhere
> into observers. I have found that I can log errors, access any model
> easily (getModel method) and trigger emails etc without introducing
> dependencies into my models and allowing my controllers to focus on
> handling application flow and exceptions.
>
> Ian
>
> On 1 Feb, 22:25, Langdon Stevenson <[EMAIL PROTECTED]> wrote:
>
> > Hi Tarique
>
> > >> What is the recommended approach for an AfterSave function triggering
> > >> and sending an email notification on a saved or submitted form? Thanks.
>
> > > I personally prefer doing this in the Controller as I tend to use a
> > > component to send emails. Keeps the Model free of any dependencies
>
> > > If at all you want to do this with the Model then I would suggest make
> > > the Model Observable and the Email component should be an Observer
>
> > I was having thoughts along those lines too.  I have a project underway
> > that will require exactly that functionality.
>
> > For instance: when a stock level in the database reaches a certain point
> > it should trigger a variety of functions like emailing people and
> > queuing new orders.  I don't want to tie this to the model, but make it
> > a configurable option with its own controller.
>
> > Regards,
> > Langdon


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to