示例#1
0
 /**
  * @return array
  */
 public function getPath(Node $node)
 {
     if (array_key_exists($node->getIdentifier(), $this->paths)) {
         return $this->paths[$node->getIdentifier()];
     } else {
         return $this->paths[$node->getIdentifier()] = $this->repository->getPath($node);
     }
 }
示例#2
0
 /**
  * @return bool
  */
 public function equalsNode(WebforgeNode $other = NULL)
 {
     if (!isset($other)) {
         return FALSE;
     }
     if ($this->isNew() || $other->isNew()) {
         return spl_object_hash($this) === spl_object_hash($other);
     }
     return $this->equals($other);
 }
 public function childrenQueryBuilder(NavigationNode $node = NULL, $qbHook = NULL)
 {
     $qb = $this->createQueryBuilder('node');
     if ($node) {
         $qb->where($qb->expr()->lt('node.rgt', $node->getRgt()))->andWhere($qb->expr()->gt('node.lft', $node->getLft()));
         $rootId = $node->getRoot();
         $qb->andWhere($rootId === NULL ? $qb->expr()->isNull('node.root') : $qb->expr()->eq('node.root', is_string($rootId) ? $qb->expr()->literal($rootId) : $rootId));
     }
     // context
     $qb->andWhere('node.context = :context')->setParameter('context', $this->context);
     $qb->orderBy('node.lft', 'ASC');
     if (isset($qbHook)) {
         $qbHook($qb);
     }
     return $qb;
 }