Oh, and another question: should I check whether the model has already the behavior XYZ attached before trying to attach it? (I'm using many behaviors in different plugins etc., so it could happen that a behavior is attached more than once.)
On Tue, Dec 14, 2010 at 11:11 AM, psybear83 <[email protected]> wrote: > Hey all > > I'd like to add a behavior to the AppModel on the fly from within a > component. Normally you do... > > $this->Controller->MyModel->Behaviors->attach('MyBehavior'); > > ...but sadly for AppModel this doesn't work: > > $this->Controller->AppModel->Behaviors->attach('MyBehavior'); > > ...results in: > > Fatal error: Call to a member function attach() on a non-object > > But I guess there IS a way to do that, isn't there? :-) > > Thanks for help, > Josh > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" 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 > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" 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
