mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-02-07 12:36:25 +00:00
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:
parent
465c24f903
commit
95168cee6e
2 changed files with 3 additions and 1 deletions
|
@ -284,7 +284,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
$conditions = $scope;
|
$conditions = $scope;
|
||||||
} else {
|
} else {
|
||||||
$result = array_values($Model->find('first', array(
|
$result = array_values((array)$Model->find('first', array(
|
||||||
'conditions' => array($scope, $Model->escapeField() => $id),
|
'conditions' => array($scope, $Model->escapeField() => $id),
|
||||||
'fields' => array($left, $right),
|
'fields' => array($left, $right),
|
||||||
'recursive' => $recursive
|
'recursive' => $recursive
|
||||||
|
|
|
@ -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' => 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)));
|
array($modelClass => array('id' => 7, 'name' => '1.2.2', $parentField => 5, $leftField => 11, $rightField => 12)));
|
||||||
$this->assertEqual($total, $expects);
|
$this->assertEqual($total, $expects);
|
||||||
|
|
||||||
|
$this->assertEqual(array(), $this->Tree->children(10000));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue