/**
  * Add query part to select descendants of $node.
  *
  * @param  \BackBee\CoreDomain\NestedNode\AbstractNestedNode                       $node
  * @param  boolean                                               $strict   If TRUE, $node is excluded from the selection
  * @param  int                                                   $at_level Filter ancestors by their level
  * @param  string                                                $alias    optional, the alias to use
  * @return \BackBee\NestedNode\Repository\NestedNodeQueryBuilder
  */
 public function andIsDescendantOf(AbstractNestedNode $node, $strict = false, $at_level = null, $alias = null)
 {
     $this->andRootIs($node->getRoot(), $alias)->andLeftnodeIsUpperThan($node->getLeftnode(), $strict, $alias)->andRightnodeIsLowerThan($node->getRightnode(), $strict, $alias);
     if (null !== $at_level) {
         $this->andLevelEquals($at_level);
     }
     return $this;
 }
 /**
  * Shift part of a tree.
  *
  * @param  \BackBee\CoreDomain\NestedNode\AbstractNestedNode                     $node
  * @param  integer                                                    $first
  * @param  integer                                                    $delta
  * @param  \BackBee\CoreDomain\NestedNode\AbstractNestedNode                     $target
  * @return \BackBee\CoreDomain\NestedNode\Repository\NestedNodeRepository
  */
 private function shiftRlValues(AbstractNestedNode $node, $first, $delta)
 {
     $this->createQueryBuilder('n')->set('n._leftnode', 'n._leftnode + :delta')->andRootIs($node->getRoot())->andLeftnodeIsUpperThan($first)->setParameter('delta', $delta)->update()->getQuery()->execute();
     $this->createQueryBuilder('n')->set('n._rightnode', 'n._rightnode + :delta')->andRootIs($node->getRoot())->andRightnodeIsUpperThan($first)->setParameter('delta', $delta)->update()->getQuery()->execute();
     return $this;
 }
 /**
  * Is this node is a descendant of the provided one ?
  *
  * @param  \BackBee\CoreDomain\NestedNode\AbstractNestedNode $node
  * @param  Boolean                         $strict Optional, if TRUE (default) this node is excluded of descendants list
  *
  * @return Boolean                         TRUE if this node is a descendant or provided node, FALSE otherwise
  */
 public function isDescendantOf(AbstractNestedNode $node, $strict = true)
 {
     if (true === $strict) {
         return $this->getLeftnode() > $node->getLeftnode() && $this->getRightnode() < $node->getRightnode() && $this->getRoot() === $node->getRoot();
     } else {
         return $this->getLeftnode() >= $node->getLeftnode() && $this->getRightnode() <= $node->getRightnode() && $this->getRoot() === $node->getRoot();
     }
 }