I sometimes use code similar to the following in the beforeFilter() of
my controller:

/* function is not in byPass array and isnt being called by another function */
if(in_array($this->action,$byPass) === FALSE AND $this->action != __FUNCTION__){

}

Gary

On Nov 18, 2007 4:47 PM, Grant Cox <[EMAIL PROTECTED]> wrote:
>
> No, you cannot access ANYTHING from the controller in the model -
> that's one of the core parts of MVC.
>
> What you should do is define a new function in your model -
> register()  This can set some class variable which you can check in
> your other callbacks, eg:
>
> class YourModel extends AppModel {
>
>         var $name = 'YourModel';
>
>         var $is_registering = false;
>
>         function register( $data )
>         {
>                 $this->is_registering = true;
>                 return $this->save( $data );
>         }
>
>         function beforeValidate()
>         {
>                 if ( $this->is_registering ){
>                         ...
>                 }
>         }
>
>         function afterSave()
>         {
>                 if ( $this->is_registering ){
>                         ...
>
>                 }
>         }
> }
>
>
>
> On Nov 18, 6:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > It would be great, but model doesn't have field action :/ Any other
> > ideas how to check action in model?
> >
>

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