Permalink
Browse files

Fixing condition missing a model name in the TreeBehavior. Fixes #961

  • Loading branch information...
markstory committed Jul 31, 2010
1 parent 9ea6800 commit 4ca3266456f05f6ce0ff0028be0de27736179b86
Showing with 5 additions and 2 deletions.
  1. +5 −2 cake/libs/model/behaviors/tree.php
@@ -691,7 +691,10 @@ function removefromtree(&$Model, $id = null, $delete = false) {
}
$db =& ConnectionManager::getDataSource($Model->useDbConfig);
- $Model->updateAll(array($parent => $db->value($node[$parent], $parent)), array($parent => $node[$Model->primaryKey]));
+ $Model->updateAll(
+ array($parent => $db->value($node[$parent], $parent)),
+ array($Model->escapeField($parent) => $node[$Model->primaryKey])
+ );
$this->__sync($Model, 1, '-', 'BETWEEN ' . ($node[$left] + 1) . ' AND ' . ($node[$right] - 1));
$this->__sync($Model, 2, '-', '> ' . ($node[$right]));
$Model->id = $id;
@@ -941,4 +944,4 @@ function __sync(&$Model, $shift, $dir = '+', $conditions = array(), $created = f
$Model->recursive = $ModelRecursive;
}
}
-?>
+?>

0 comments on commit 4ca3266

Please sign in to comment.