1
0
mirror of synced 2024-12-14 15:16:04 +03:00

Added missing multiple root support for Doctrine_Node_NestedSet::getParent()

This commit is contained in:
romanb 2007-02-10 18:07:05 +00:00
parent 18cf2887cf
commit 93a737b4e1

View File

@ -196,10 +196,12 @@ class Doctrine_Node_NestedSet extends Doctrine_Node implements Doctrine_Node_Int
$q = $this->record->getTable()->createQuery();
$componentName = $this->record->getTable()->getComponentName();
$parent = $q->where("$componentName.lft < ? AND $componentName.rgt > ?", array($this->getLeftValue(), $this->getRightValue()))
->orderBy("$componentName.rgt asc")
->execute()
->getFirst();
$q = $q->where("$componentName.lft < ? AND $componentName.rgt > ?", array($this->getLeftValue(), $this->getRightValue()))
->orderBy("$componentName.rgt asc");
$q = $this->record->getTable()->getTree()->returnQueryWithRootId($q, $this->getRootValue());
$parent = $q->execute()->getFirst();
if(!$parent)
$parent = $this->record->getTable()->create();