Skip to content

Commit

Permalink
Merge pull request cakephp#2526 from cakephp/master-behavior-aliasing
Browse files Browse the repository at this point in the history
Aliasing behaviors
  • Loading branch information
markstory committed Mar 23, 2015
2 parents 6223afb + 1d653a3 commit 095a0ba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions en/models/behaviors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ We can also use the load method to override behavior settings::
// We will change one setting from our already attached behavior
$this->Category->Behaviors->load('Tree', array('left' => 'new_left_node'));

And using aliasing, we can customize the alias it will be loaded as, also allowing it to be loaded
multiple times with different settings::

// The behavior will be available as 'MyTree'
$this->Category->Behaviors->load('MyTree', array('className' => 'Tree'));

There's also a method to obtain the list of behaviors a model has
attached. If we pass the name of a behavior to the method, it will
tell us if that behavior is attached to the model, otherwise it
Expand Down

0 comments on commit 095a0ba

Please sign in to comment.