Fix TreeBehavior does access property/method via model

This commit is contained in:
chinpei215 2016-12-13 07:15:48 +09:00
parent 420336f536
commit 21502db34a

View file

@ -112,11 +112,12 @@ class TreeBehavior extends ModelBehavior {
* @return void
*/
protected function _setChildrenLevel(Model $Model, $id) {
$settings = $Model->Behaviors->Tree->settings[$Model->alias];
$settings = $this->settings[$Model->alias];
$primaryKey = $Model->primaryKey;
$depths = array($id => (int)$Model->data[$Model->alias][$settings['level']]);
$children = $Model->children(
$children = $this->children(
$Model,
$id,
false,
array($primaryKey, $settings['parent'], $settings['level']),