소스 검색

[tree] fixed back persistAs method for siblings which was broken by PR #208

gedi 13 년 전
부모
커밋
67045fc4a8
1개의 변경된 파일4개의 추가작업 그리고 5개의 파일을 삭제
  1. 4 5
      lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php

+ 4 - 5
lib/Gedmo/Tree/Entity/Repository/NestedTreeRepository.php

@@ -93,17 +93,16 @@ class NestedTreeRepository extends AbstractTreeRepository
                 if (!isset($args[1])) {
                     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);
+                $parentOrSibling = $args[1];
+                $wrapped->setPropertyValue($config['parent'], $parentOrSibling);
                 $position = substr($position, 0, -2);
             }
             $wrapped->setPropertyValue($config['left'], 0); // simulate changeset
             $oid = spl_object_hash($node);
             $this->listener
                 ->getStrategy($this->_em, $meta->name)
-                ->setNodePosition($oid, $position);
+                ->setNodePosition($oid, $position)
+            ;
 
             $this->_em->persist($node);
             return $this;