Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor optimization in TreeBehavior::getparentnode() to avoid fetching…

… unneeded associated records. Closes #572
  • Loading branch information...
commit baaae6cdb79d368cf864777dd7133208d55f09c4 1 parent 404401b
@ADmad ADmad authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  cake/libs/model/behaviors/tree.php
View
2  cake/libs/model/behaviors/tree.php
@@ -382,7 +382,7 @@ function getparentnode(&$Model, $id = null, $fields = null, $recursive = null) {
if (!is_null($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) {
$parentId = $parentId[$Model->alias][$parent];
Please sign in to comment.
Something went wrong with that request. Please try again.