mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
parent
d238d8c0bb
commit
a8bc916104
1 changed files with 8 additions and 7 deletions
|
@ -2815,16 +2815,17 @@ class Model extends Object implements CakeEventListener {
|
|||
$return = $idMap = array();
|
||||
$ids = Set::extract($results, '{n}.' . $this->alias . '.' . $this->primaryKey);
|
||||
|
||||
if (isset($results[0][$this->alias]) && !array_key_exists('parent_id', $results[0][$this->alias])) {
|
||||
trigger_error(
|
||||
__d('cake_dev', 'You cannot use find("threaded") on models without a "parent_id" field.'),
|
||||
E_USER_WARNING
|
||||
);
|
||||
return $return;
|
||||
}
|
||||
|
||||
foreach ($results as $result) {
|
||||
$result['children'] = array();
|
||||
$id = $result[$this->alias][$this->primaryKey];
|
||||
if (!isset($result[$this->alias]['parent_id'])) {
|
||||
trigger_error(
|
||||
__d('cake_dev', 'You cannot use find("threaded") on models without a "parent_id" field.'),
|
||||
E_USER_WARNING
|
||||
);
|
||||
return $return;
|
||||
}
|
||||
$parentId = $result[$this->alias]['parent_id'];
|
||||
if (isset($idMap[$id]['children'])) {
|
||||
$idMap[$id] = array_merge($result, (array)$idMap[$id]);
|
||||
|
|
Loading…
Reference in a new issue