cevou 12 anni fa
parent
commit
329bf0a146

+ 1 - 1
lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php

@@ -97,8 +97,8 @@ class NestedTreeRepository extends AbstractTreeRepository
                     throw new \Gedmo\Exception\InvalidArgumentException('If "Of" is specified you must provide parent or sibling as the second argument');
                     throw new \Gedmo\Exception\InvalidArgumentException('If "Of" is specified you must provide parent or sibling as the second argument');
                 }
                 }
                 $parentOrSibling = $args[1];
                 $parentOrSibling = $args[1];
-                $wrappedParentOrSibling = new EntityWrapper($parentOrSibling, $this->_em);
                 if (strstr($method,'Sibling')) {
                 if (strstr($method,'Sibling')) {
+                    $wrappedParentOrSibling = new EntityWrapper($parentOrSibling, $this->_em);
                     $newParent = $wrappedParentOrSibling->getPropertyValue($config['parent']);
                     $newParent = $wrappedParentOrSibling->getPropertyValue($config['parent']);
                     if (is_null($newParent)) {
                     if (is_null($newParent)) {
                         throw new UnexpectedValueException("Cannot persist sibling for a root node, tree operation is not possible");
                         throw new UnexpectedValueException("Cannot persist sibling for a root node, tree operation is not possible");