Example #1
0
 /**
  * Returns the new parent node from $dest node and position.
  *
  * @param  \BackBee\NestedNode\AbstractNestedNode $dest
  * @param  string                          $position
  * @return \BackBee\NestedNode\AbstractNestedNode
  * @throws InvalidArgumentException        Occurs if $position is unknown
  */
 private function getNewParentFromPosition(AbstractNestedNode $dest, $position)
 {
     switch ($position) {
         case 'before':
         case 'after':
             $newparent = $dest->getParent();
             break;
         case 'firstin':
         case 'lastin':
             $newparent = $dest;
             break;
         default:
             throw new InvalidArgumentException(sprintf('Unknown position %s to move node', $position));
     }
     return $newparent;
 }
 /**
  * Add query part to select next siblings of node.
  *
  * @param  \BackBee\NestedNode\AbstractNestedNode                       $node
  * @param  string                                                $alias optional, the alias to use
  * @return \BackBee\NestedNode\Repository\NestedNodeQueryBuilder
  */
 public function andIsNextSiblingsOf(AbstractNestedNode $node, $alias = null)
 {
     return $this->andParentIs($node->getParent(), $alias)->andLeftnodeIsUpperThan($node->getRightnode(), true, $alias);
 }