Fixing bug when primaryKey is not id. Fixes #5615.

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7757 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
renan.saddam 2008-10-17 00:01:36 +00:00
parent 24949e30e0
commit e3fb56f6be

View file

@ -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));