Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
dogmatic69 authored and markstory committed Aug 27, 2010
1 parent 465c24f commit 95168ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cake/libs/model/behaviors/tree.php
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions cake/tests/cases/libs/model/behaviors/tree.test.php
Expand Up @@ -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));
}

/**
Expand Down

0 comments on commit 95168ce

Please sign in to comment.