I am trying to implement a Tree of Categories in CakePHP.
If I add this line in AppModel:
public $actsAs = array('Tree');
and output this from CategoriesController:
$behaviors = $this->Category->Behaviors->attached();
debug($behaviors); die;
The result is:
array(
(int) 0 => 'Tree'
)
But I don't want all my models to behave like Tree. So if I add this in the Category model (Category.php):
public $actsAs = array('Tree');
And output this from CategoriesController:
$behaviors = $this->Category->Behaviors->attached();
debug($behaviors); die;
The result is:
array()
Any idea why? The cookbook here: http://book.cakephp.org/2.0/en/models/behaviors.html#using-behaviors says that I can use the $actsAs just in the models I need a specific behavior.
Thank you.