Another fix for array_values() throwing a warning when using Tree Behavior under certain

situations.
This commit is contained in:
Joël Perras 2010-02-05 13:18:46 -05:00
parent 4b269e3170
commit 2c1e6de7d6

View file

@ -163,10 +163,15 @@ class TreeBehavior extends ModelBehavior {
$Model->data[$Model->alias][$parent] = null;
$this->_addToWhitelist($Model, $parent);
} else {
list($node) = array_values($Model->find('first', array(
$values = $Model->find('first', array(
'conditions' => array($scope,$Model->escapeField() => $Model->id),
'fields' => array($Model->primaryKey, $parent, $left, $right ), 'recursive' => $recursive)
));
);
if ($values === false) {
return false;
}
list($node) = array_values($values);
$parentNode = $Model->find('first', array(
'conditions' => array($scope, $Model->escapeField() => $Model->data[$Model->alias][$parent]),