Permalink
Browse files

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>
  • Loading branch information...
1 parent 465c24f commit 95168cee6e4a75f85ed414e7be48c93eb9d49929 @dogmatic69 dogmatic69 committed with markstory Aug 24, 2010
Showing with 3 additions and 1 deletion.
  1. +1 −1 cake/libs/model/behaviors/tree.php
  2. +2 −0 cake/tests/cases/libs/model/behaviors/tree.test.php
@@ -284,7 +284,7 @@ function children(&$Model, $id = null, $direct = false, $fields = null, $order =
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
@@ -1089,6 +1089,8 @@ function testChildren() {
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));
}
/**

0 comments on commit 95168ce

Please sign in to comment.