CakePHP Model Binding with TreeBehavior methods -


i making use of cakephp treebehavior class.

$this->set('sports', $this->sport->children(1,true)); 

as can see bellow, function returns children need, not bind models. name of sport stored in table tags. associations defined in model , binds them if use 'find' method queries. there way use treebehavior functions , force model binding ?

array( (int) 0 => array(     'sport' => array(         'id' => '2',         'parent_id' => '1',         'lft' => '6',         'rght' => '7',         'tag_id' => '51f0099f-ead0-4f41-8d0f-176c9c2b3e89'     ) ), (int) 1 => array(     'sport' => array(         'id' => '3',         'parent_id' => '1',         'lft' => '8',         'rght' => '11',         'tag_id' => '79177f20-f46a-11e2-96ba-00116b93c9e5'     ) )  ) 

if need direct children why not use model::find method?

$this->sport->find('all', array('conditions'=>array('sport.parent_id'=>1)) 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -