src/Kunstmaan/MediaBundle/Repository/FolderRepository.php
public function selectFolderQueryBuilder(Folder $ignoreSubtree = null)
    {
        /** @var QueryBuilder $qb */
        $qb = $this->createQueryBuilder('f');
        $qb->where('f.deleted != true')
            ->orderBy('f.lft');

        // Fetch all folders except the current one and its children
        if (!is_null($ignoreSubtree) && $ignoreSubtree->getId() !== null) {
            $orX = $qb->expr()->orX();
            $orX->add('f.rgt > :right')
                ->add('f.lft < :left');

            $qb->andWhere($orX)
                ->setParameter('left', $ignoreSubtree->getLeft())
                ->setParameter('right', $ignoreSubtree->getRight());
        }

        return $qb;
    }
public function selectFolderQueryBuilder(Folder $ignoreSubtree = null)
    {
        /** @var QueryBuilder $qb */
        $qb = $this->createQueryBuilder('f');
        $qb->where('f.deleted != true')
            ->orderBy('f.lft');

        // Fetch all folders except the current one and its children
        if (!is_null($ignoreSubtree) && $ignoreSubtree->getId() !== null) {
            $orX = $qb->expr()->orX();
            $orX->add('f.rgt > :right')
                ->add('f.lft < :left');

            $qb->andWhere($orX)
                ->setParameter('left', $ignoreSubtree->getLeft())
                ->setParameter('right', $ignoreSubtree->getRight());
        }

        return $qb;
    }
public function selectFolderQueryBuilder ( Folder $ ignoreSubtree = null ) { /** @var QueryBuilder $qb */ $ qb = $ this -> createQueryBuilder ( 'f' ) ; $ qb -> where ( 'f.deleted != true' ) -> orderBy ( 'f.lft' ) ; // Fetch all folders except the current one and its children if ( ! is_null ( $ ignoreSubtree ) && $ ignoreSubtree -> getId ( ) !== null ) { $ orX = $ qb -> expr ( ) -> orX ( ) ; $ orX -> add ( 'f.rgt > :right' ) -> add ( 'f.lft < :left' ) ; $ qb -> andWhere ( $ orX ) -> setParameter ( 'left' , $ ignoreSubtree -> getLeft ( ) ) -> setParameter ( 'right' , $ ignoreSubtree -> getRight ( ) ) ; } return $ qb ; }
Used as querybuilder for Folder entity selectors

@param Folder $ignoreSubtree Folder (with children) that has to be filtered out (optional)

@return QueryBuilder
Used as querybuilder for Folder entity selectors