Saturday, August 17, 2013

Re: Extend a core behavoir

I looked into the core TreeBehavoir and there was this line:
App::uses('ModelBehavior', 'Model');

so I thought it is loading the class ModelBehavior AND class Model, but you are right, now I took a look into the docs and saw that the second parameter is the package.

again thanks for the help!

Regards,
MN


________________________________________
Java & C# desktop developer
PHP web developer


On Fri, Aug 16, 2013 at 9:42 PM, euromark <dereuromark@gmail.com> wrote:
Where did you find / get the idea that
  App::uses('ModelBehavior', 'TreeBehavior', 'Model');
is a valid method call?

It is
  App::uses('TreeBehavior', 'Model/Behavior');
as you can easily find out opening some of the core test files

Then you can easily extend it in your own app.


Am Freitag, 16. August 2013 14:47:02 UTC+2 schrieb Mohammad Naghavi:
thanks, I tried to use App:uses but I got a fatal error "Class 'TreeBehavior' not found in..." I had this following line:

App::uses('ModelBehavior', 'TreeBehavior', 'Model');

but anyway using App::import it works as it should.

thanks,
MN

________________________________________
Java & C# desktop developer
PHP web developer


On Thu, Aug 15, 2013 at 4:02 PM, Rodrigo MourĂ£o <rod...@webjump.com.br> wrote:
I already didi this with tree behavior like Andre recommended.

models/behaviors/tree_plus.php
<?php
App::import('Behavior', 'Tree');
class TreePlusBehavior extends TreeBehavior {    

}

Em quarta-feira, 14 de agosto de 2013 11h36min29s UTC-3, André Luis escreveu:
With App::import()...

Them you can extend it:
class MyTreeBehavior extends TreeBehavior...

Em quarta-feira, 14 de agosto de 2013 10h05min03s UTC-3, Mohammad Naghavi escreveu:
Hi All,
I want to extend the core TreeBehavior without replacing it or copying it to my own behavior folder, I just want to extend it to add some additional functionalists which are based on tree behavior.
is there a way to do it?

regards,
Mohammad

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+u...@googlegroups.com.
To post to this group, send email to cake...@googlegroups.com.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: