mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
Minor optimization in TreeBehavior::getparentnode() to avoid fetching unneeded associated records. Closes #572
This commit is contained in:
parent
404401b4de
commit
baaae6cdb7
1 changed files with 1 additions and 1 deletions
|
@ -382,7 +382,7 @@ class TreeBehavior extends ModelBehavior {
|
||||||
if (!is_null($overrideRecursive)) {
|
if (!is_null($overrideRecursive)) {
|
||||||
$recursive = $overrideRecursive;
|
$recursive = $overrideRecursive;
|
||||||
}
|
}
|
||||||
$parentId = $Model->read($parent, $id);
|
$parentId = $Model->find('first', array('conditions' => array($Model->primaryKey => $id), 'fields' => array($parent), 'recursive' => -1));
|
||||||
|
|
||||||
if ($parentId) {
|
if ($parentId) {
|
||||||
$parentId = $parentId[$Model->alias][$parent];
|
$parentId = $parentId[$Model->alias][$parent];
|
||||||
|
|
Loading…
Add table
Reference in a new issue