From e3fb56f6befb56088295ae6e74aa4a06783b7454 Mon Sep 17 00:00:00 2001 From: "renan.saddam" Date: Fri, 17 Oct 2008 00:01:36 +0000 Subject: [PATCH] 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 --- cake/libs/model/behaviors/tree.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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));