Commit e90e62c9 authored by romanb's avatar romanb

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

parent a1ee3f97
......@@ -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());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment