Hey Grant,

Is that cool?

In the MVC scheme of things I mean. Calling a Component from a Model.

There have been some instances that I would have liked to delete files
in an afterSave but the functions to do so were nicely packaged in a
Component.

On 02/02/07, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> I guess the problem you have is that you can't access components (ie
> to send an email) from a Model.  The options you have are:
>  - Use loadComponent in your model to get access to your email
> component.
>  - Put the email sending functionality into your model (or app_model,
> or a model behaviour), as you can still use vendor() in a model.
>  - Use requestAction from the model to execute an appropriate
> controller action
>  - Handle the email sending in your controller, after a successful
> save.  This is good if you only have a couple of possible save points.
>
> Personally, I like the idea of having a Model Behaviour, which uses
> loadComponent to access your email sending component.  The behaviour
> would provide a simplified api, so your models could just have
>
> function afterSave(){
>   $this->sendEmail( $to, $message );
> }
>
> Of course, I like this just because I haven't made any Model
> Behaviours yet, and they sound pretty cool :)
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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