예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function findNodeParents(NodeInterface $node)
 {
     $qb = $this->repository->createQueryBuilder('n');
     $qb->andWhere($qb->expr()->eq('n.root', ':root'))->setParameter('root', $node->getRoot());
     $qb->andWhere($qb->expr()->lt('n.left', ':left'))->setParameter('left', $node->getLeft());
     $qb->andWhere($qb->expr()->gt('n.right', ':right'))->setParameter('right', $node->getRight());
     $qb->addOrderBy('n.left');
     $qb->select('n');
     return $qb->getQuery()->getResult();
 }
 /**
  * {@inheritdoc}
  */
 public function findNodeAllChildrenTranslationsByLang(NodeInterface $node, $lang)
 {
     $qb = $this->repository->createQueryBuilder('t');
     $qb->innerJoin('t.node', 'n');
     $qb->andWhere($qb->expr()->eq('t.lang', ':locale'));
     $qb->setParameter('locale', $lang);
     $qb->andWhere($qb->expr()->eq('n.root', ':root'))->setParameter('root', $node->getRoot());
     $qb->andWhere($qb->expr()->gte('n.left', ':left'))->setParameter('left', $node->getLeft());
     $qb->andWhere($qb->expr()->lte('n.right', ':right'))->setParameter('right', $node->getRight());
     $qb->select('t');
     return $qb->getQuery()->getResult();
 }