fixes #4841, TreeBehavior ambiguous columns

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7196 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-06-15 17:51:25 +00:00
parent 9d87ce5a06
commit eb67aa879e

View file

@ -562,7 +562,7 @@ class TreeBehavior extends ModelBehavior {
} elseif ($missingParentAction == 'delete') { } elseif ($missingParentAction == 'delete') {
$model->deleteAll(array($model->primaryKey => array_flip($missingParents))); $model->deleteAll(array($model->primaryKey => array_flip($missingParents)));
} else { } else {
$model->updateAll(array($parent => $missingParentAction), array($model->primaryKey => array_flip($missingParents))); $model->updateAll(array($parent => $missingParentAction), array($model->escapeField($model->primaryKey) => array_flip($missingParents)));
} }
} }
$count = 1; $count = 1;
@ -762,7 +762,7 @@ class TreeBehavior extends ModelBehavior {
$errors[] = array('node', $instance[$model->alias][$model->primaryKey], $errors[] = array('node', $instance[$model->alias][$model->primaryKey],
'right greater than parent (node ' . $instance['VerifyParent'][$model->primaryKey] . ').'); 'right greater than parent (node ' . $instance['VerifyParent'][$model->primaryKey] . ').');
} }
} elseif ($model->find('count', array('conditions' => array($scope, $left . '< ' . $instance[$model->alias][$left], $right . '> ' . $instance[$model->alias][$right]), 'recursive' => 0))) { } elseif ($model->find('count', array('conditions' => array($scope, $model->escapeField($left) . '< ' . $instance[$model->alias][$left], $right . '> ' . $instance[$model->alias][$right]), 'recursive' => 0))) {
$errors[] = array('node', $instance[$model->alias][$model->primaryKey], 'The parent field is blank, but has a parent'); $errors[] = array('node', $instance[$model->alias][$model->primaryKey], 'The parent field is blank, but has a parent');
} }
} }
@ -800,7 +800,7 @@ class TreeBehavior extends ModelBehavior {
if (empty($parentNode) || empty($parentNode[0])) { if (empty($parentNode) || empty($parentNode[0])) {
return false; return false;
} }
$parentNode = $parentNode[0]; $parentNode = $parentNode[0];
if (($model->id == $parentId)) { if (($model->id == $parentId)) {