Browse Source

Fixed persistAs*SiblingOf methods. Previously sibling's been used as parent, what hasn't been valid.

Daniel Bojdo 13 years ago
parent
commit
4472576c7d
1 changed files with 2 additions and 0 deletions
  1. 2 0
      lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php

+ 2 - 0
lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php

@@ -94,6 +94,8 @@ class NestedTreeRepository extends AbstractTreeRepository
                     throw new \Gedmo\Exception\InvalidArgumentException('If "Of" is specified you must provide parent or sibling as the second argument');
                 }
                 $parent = $args[1];
+    			$parent = substr($method,-7) == 'ChildOf' ? $parent : $parent->getParent();
+                
                 $wrapped->setPropertyValue($config['parent'], $parent);
                 $position = substr($position, 0, -2);
             }