diff --git a/cake/libs/model/behaviors/tree.php b/cake/libs/model/behaviors/tree.php index 9f82ac06d..d7caab232 100644 --- a/cake/libs/model/behaviors/tree.php +++ b/cake/libs/model/behaviors/tree.php @@ -582,7 +582,7 @@ class TreeBehavior extends ModelBehavior { } $count = 1; foreach ($model->find('all', array('conditions' => $scope, 'fields' => array($model->primaryKey), 'order' => $left)) as $array) { - $model->{$model->primaryKey} = $array[$model->alias][$model->primaryKey]; + $model->id = $array[$model->alias][$model->primaryKey]; $lft = $count++; $rght = $count++; $model->save(array($left => $lft, $right => $rght), array('callbacks' => false));