Thanks, amit.

@Mark: You're completely right, but I have a component that assumes
that every model has this component attached, and it would be nice if
this attaching could be done automatically... So I guess I will have
to attach it to every single model, then.

On Tue, Dec 14, 2010 at 3:56 PM, euromark <[email protected]> wrote:
> you never use the app model directly
> so there should be no need to do is on app model level dynamically
>
> just hard-code it:
>
> var $actsAs  = ...
>
>
> On 14 Dez., 13:01, Amit Badkas <[email protected]> wrote:
>> Hi,
>>
>> You can use $this->Controller->MyModel->Behaviors->attached('MyBehavior');
>> code to check if a particular behavior attached to a particular model or not
>>
>> Amit Badkas
>>
>> PHP Applications for E-Biz:http://www.sanisoft.com
>>
>>
>>
>>
>>
>>
>>
>> On Tue, Dec 14, 2010 at 5:02 PM, Joshua Muheim <[email protected]> wrote:
>> > 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 sitehttp://cakeqs.organd 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]<cake-php%[email protected]
>> > >  om>For more options, visit this group at
>> >http://groups.google.com/group/cake-php?hl=en
>>
>> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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]<cake-php%[email protected]
>> >  om>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
>

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

Reply via email to