casting the find as an array to avoid errors with array_values() fixes #1041 and 4 failing tests (3 previous)

Signed-off-by: mark_story <mark@mark-story.com>
This commit is contained in:
dogmatic69 2010-08-24 12:14:46 +01:00 committed by mark_story
parent 465c24f903
commit 95168cee6e
2 changed files with 3 additions and 1 deletions

View file

@ -284,7 +284,7 @@ class TreeBehavior extends ModelBehavior {
if (!$id) {
$conditions = $scope;
} else {
$result = array_values($Model->find('first', array(
$result = array_values((array)$Model->find('first', array(
'conditions' => array($scope, $Model->escapeField() => $id),
'fields' => array($left, $right),
'recursive' => $recursive

View file

@ -1089,6 +1089,8 @@ class NumberTreeTest extends CakeTestCase {
array($modelClass => array( 'id' => 6, 'name' => '1.2.1', $parentField => 5, $leftField => 9, $rightField => 10)),
array($modelClass => array('id' => 7, 'name' => '1.2.2', $parentField => 5, $leftField => 11, $rightField => 12)));
$this->assertEqual($total, $expects);
$this->assertEqual(array(), $this->Tree->children(10000));
}
/**