On Jun 19, 6:26 am, Max <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I've been trying to find more about behaviors to start with them. But
> I dont seem to find much information about them anywhere on the
> CakePHP sites/Internet..
>
> However, There are a lot of behaviors code snippets available, but
> what I'm looking after is some more basic information like - why we
> use them ? what are the advantages ? etc...

A behavior modifies the way any model that uses it works, and/or
effectively adds methods to a model as if they were defined /in/ the
model.

E.g.

1)
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/behaviors/acl.php?rev=5132#L92
This method will automatically create an ARO/ACO whenever you insert a
new row in the associated table (e.g. you save your new user, and they
get added automatically to your ACL system)

2)
https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/model/behaviors/tree.php?rev=5132#L142
This method is called as $noOfChildren = $this->ModelName-
>childcount(); from a controller, for any model that has that
behavior. The method childcount does not exist /in/ the model code,
it's in the behavior.

hth,

AD


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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