public function getContentFromRequest(Request $request)
    {
        $qb = $this->createValuedQueryBuilder('c');

        if ($request->get('q')) {
            $qb->leftJoin('c.template', 't');
            $qb->andWhere('c.title LIKE :query OR c.alias LIKE :query OR c.slug LIKE :query OR t.displayName LIKE :query');
            $qb->setParameter('query', '%'.$request->get('q').'%');
        }

        if ($ids = $request->get('ids')) {
            $ids = explode(',', $ids);

            $qb->andWhere('c.id IN (:ids)')->setParameter('ids', $ids);
        }

        $qb->andWhere('c.deletedAt IS NULL AND c.layout = :layout');  // @TODO fix SoftDeleteAble & layout filter
        $qb->setParameter('layout', false);

        $qb->orderBy('c.slug');

        return $qb->getQuery()
            ->getResult();
    }
public function getContentFromRequest(Request $request)
    {
        $qb = $this->createValuedQueryBuilder('c');

        if ($request->get('q')) {
            $qb->leftJoin('c.template', 't');
            $qb->andWhere('c.title LIKE :query OR c.alias LIKE :query OR c.slug LIKE :query OR t.displayName LIKE :query');
            $qb->setParameter('query', '%'.$request->get('q').'%');
        }

        if ($ids = $request->get('ids')) {
            $ids = explode(',', $ids);

            $qb->andWhere('c.id IN (:ids)')->setParameter('ids', $ids);
        }

        $qb->andWhere('c.deletedAt IS NULL AND c.layout = :layout');  // @TODO fix SoftDeleteAble & layout filter
        $qb->setParameter('layout', false);

        $qb->orderBy('c.slug');

        return $qb->getQuery()
            ->getResult();
    }
public function getContentFromRequest ( Request $ request ) { $ qb = $ this -> createValuedQueryBuilder ( 'c' ) ; if ( $ request -> get ( 'q' ) ) { $ qb -> leftJoin ( 'c.template' , 't' ) ; $ qb -> andWhere ( 'c.title LIKE :query OR c.alias LIKE :query OR c.slug LIKE :query OR t.displayName LIKE :query' ) ; $ qb -> setParameter ( 'query' , '%' . $ request -> get ( 'q' ) . '%' ) ; } if ( $ ids = $ request -> get ( 'ids' ) ) { $ ids = explode ( ',' , $ ids ) ; $ qb -> andWhere ( 'c.id IN (:ids)' ) -> setParameter ( 'ids' , $ ids ) ; } $ qb -> andWhere ( 'c.deletedAt IS NULL AND c.layout = :layout' ) ; // @TODO fix SoftDeleteAble & layout filter $ qb -> setParameter ( 'layout' , false ) ; $ qb -> orderBy ( 'c.slug' ) ; return $ qb -> getQuery ( ) -> getResult ( ) ; }
Get a querybuilder by request.

@param Request $request

@return \Doctrine\ORM\QueryBuilder
Get a querybuilder by request .