1
0
mirror of synced 2025-01-31 04:21:44 +03:00

Small fix: createRoot() only generates a root id if it doesnt already have a valid value

This commit is contained in:
romanb 2007-05-07 16:05:14 +00:00
parent a1ee3f97e7
commit e90e62c9f7

View File

@ -73,8 +73,8 @@ class Doctrine_Tree_NestedSet extends Doctrine_Tree implements Doctrine_Tree_Int
$record = $this->table->create();
}
// if tree is many roots, then get next root id
if($root = $this->getAttribute('hasManyRoots')) {
// if tree is many roots, and no root id has been set, then get next root id
if ($root = $this->getAttribute('hasManyRoots') && $record->getNode()->getRootValue() <= 0) {
$record->getNode()->setRootValue($this->getNextRootId());
}