Thank you, Majna!

On Tue, Nov 23, 2010 at 10:17 PM, majna <majna...@gmail.com> wrote:
>  if ($this->MyModel->Behaviors->attached('Translate'))
>
> http://api13.cakephp.org/class/behavior-collection#method-BehaviorCollectionattached
>
> On Nov 23, 3:09 pm, Joshua Muheim <psybea...@gmail.com> wrote:
>> Oh, and is there a standard way to check whether a behavior is loaded?
>> E.g. when creating behaviors that are depending on other behaviors?
>>
>> Thanks,
>> Josh
>>
>> On Tue, Nov 23, 2010 at 3:08 PM, Joshua Muheim <psybea...@gmail.com> wrote:
>> > Oh great, I was exactly on the right track but didn't dig deep enough!
>> > Silly me. Thanks for the hint!
>>
>> > On Tue, Nov 23, 2010 at 2:42 PM, euromark <dereurom...@googlemail.com> 
>> > wrote:
>> >> well, usually, if you attach behaviors you can access those public
>> >> methods from the model:
>>
>> >> $this->Model->thisisabehaviormethod() etc
>>
>> >> so i would recommand using behaviors - thats pretty much exactly what
>> >> those behaviors are supposed to do
>> >> they enhance your current model.
>>
>> >> e.g. Tree Behavior:
>> >> genereteetreelist() can then be called in the model itself, like you
>> >> wanted to
>>
>> >> On 23 Nov., 09:02, Joshua Muheim <psybea...@gmail.com> wrote:
>> >>> So far I didn't come to a better solution than just wrapping the
>> >>> methods I want to implement:
>>
>> >>> class AppModel extends Model {
>> >>>   function someFunction($params) {
>> >>>     return BetterModel::someFunction($params);
>> >>>   }
>>
>> >>> }
>>
>> >>> But I remember that there's some OOP function in PHP5 that catches
>> >>> missing methods, right? In CakePHP, what is done with it? I know that
>> >>> I get "error in your sql syntax" or something when calling a not
>> >>> existing method, so I think CakePHP already uses this method for
>> >>> something specific, but I'm going to investigate this further. Maybe I
>> >>> can use it for my purpose (sending calls to not existing methods to a
>> >>> module or something), too. :-)
>>
>> >>> On Mon, Nov 22, 2010 at 6:13 PM, psybear83 <psybea...@gmail.com> wrote:
>> >>> > Hi all
>>
>> >>> > I have some functionality in my AppModel that I'd like to publish as a
>> >>> > plugin or so, so I can re-use the code in other projects.
>>
>> >>> > So far it looks like this:
>>
>> >>> > class AppModel extends Model {
>> >>> >  function readRandom() {}
>> >>> > }
>>
>> >>> > Now one possibility is to extract my functionality into a class that
>> >>> > will be put between AppModel and Model:
>>
>> >>> > class BetterModel extends Model {
>> >>> >  function readRandom() {}
>> >>> > }
>>
>> >>> > class AppModel extends BetterModel {
>> >>> > }
>>
>> >>> > But this isn't very flexible be cause I'm constructing a fixed
>> >>> > inheritance chain this way. In every project I'd have to put this
>> >>> > manually into my AppModel - when only having one such feature-rich
>> >>> > model this isn't a big problem, but what when I have several more
>> >>> > feature-rich models? AppModelWithFunctionality,
>> >>> > AppModelWithMoreFunctionality, AppModelWithEvenMoreFunctionality etc.?
>> >>> > Then the inheritance chain gets really awkward and isn't flexible
>> >>> > anymore when differently combining those functionalities in different
>> >>> > projects.
>>
>> >>> > So is there a solution for this? With behaviors one can create awesome
>> >>> > functionality that is run automatically, but I don't see that they
>> >>> > would help me in solving my problem...? Or do I miss something?
>>
>> >>> > Thanks a lot
>> >>> > Josh
>>
>> >>> > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp 
>> >>> > 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 cake-php@googlegroups.com
>> >>> > To unsubscribe from this group, send email to
>> >>> > cake-php+unsubscr...@googlegroups.com For more options, visit this 
>> >>> > group athttp://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 cake-php@googlegroups.com
>> >> To unsubscribe from this group, send email to
>> >> cake-php+unsubscr...@googlegroups.com For more options, visit this group 
>> >> athttp://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 cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com 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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to