From e006ebb056e0e12bcc88edfb8eb9e47fd6136622 Mon Sep 17 00:00:00 2001 From: romanb Date: Sat, 10 Feb 2007 17:32:26 +0000 Subject: [PATCH] Added missing multiple root support to Doctrine_Node_NestedSet::getAncestors(). --- lib/Doctrine/Node/NestedSet.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/Doctrine/Node/NestedSet.php b/lib/Doctrine/Node/NestedSet.php index 73c71e490..b49c62fa7 100644 --- a/lib/Doctrine/Node/NestedSet.php +++ b/lib/Doctrine/Node/NestedSet.php @@ -209,10 +209,11 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int $q = $this->record->getTable()->createQuery(); $componentName = $this->record->getTable()->getComponentName(); - $ancestors = $q->where("$componentName.lft < ? AND $componentName.rgt > ?", array($this->getLeftValue(), $this->getRightValue())) - ->orderBy("$componentName.lft asc") - ->execute(); - + $q = $q->where("$componentName.lft < ? AND $componentName.rgt > ?", array($this->getLeftValue(), $this->getRightValue())) + ->orderBy("$componentName.lft asc"); + $q = $this->record->getTable()->getTree()->returnQueryWithRootId($q, $this->getRootValue()); + $ancestors = $q->execute(); + return $ancestors; }