Skip to content

Commit

Permalink
Fixing condition missing a model name in the TreeBehavior. Fixes #961
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jul 31, 2010
1 parent 9ea6800 commit 4ca3266
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cake/libs/model/behaviors/tree.php
Expand Up @@ -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;
Expand Down Expand Up @@ -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.