public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        if (
                false === PageQueryBuilder::hasJoinCriteria($criteria) &&
                false === PageQueryBuilder::hasJoinCriteria($orderBy)
        ) {
            return parent::findBy($criteria, $orderBy, $limit, $offset);
        }

        $query = $this->createQueryBuilder('p')
                        ->addSearchCriteria($criteria);

        if (false === empty($orderBy)) {
            $query->addMultipleOrderBy($orderBy);
        }

        return $query->setMaxResults($limit)
                        ->setFirstResult($offset)
                        ->getQuery()
                        ->getResult();
    }
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
    {
        if (
                false === PageQueryBuilder::hasJoinCriteria($criteria) &&
                false === PageQueryBuilder::hasJoinCriteria($orderBy)
        ) {
            return parent::findBy($criteria, $orderBy, $limit, $offset);
        }

        $query = $this->createQueryBuilder('p')
                        ->addSearchCriteria($criteria);

        if (false === empty($orderBy)) {
            $query->addMultipleOrderBy($orderBy);
        }

        return $query->setMaxResults($limit)
                        ->setFirstResult($offset)
                        ->getQuery()
                        ->getResult();
    }
public function findBy ( array $ criteria , array $ orderBy = null , $ limit = null , $ offset = null ) { if ( false === PageQueryBuilder :: hasJoinCriteria ( $ criteria ) && false === PageQueryBuilder :: hasJoinCriteria ( $ orderBy ) ) { return parent :: findBy ( $ criteria , $ orderBy , $ limit , $ offset ) ; } $ query = $ this -> createQueryBuilder ( 'p' ) -> addSearchCriteria ( $ criteria ) ; if ( false === empty ( $ orderBy ) ) { $ query -> addMultipleOrderBy ( $ orderBy ) ; } return $ query -> setMaxResults ( $ limit ) -> setFirstResult ( $ offset ) -> getQuery ( ) -> getResult ( ) ; }
Finds entities by a set of criteria with automatic join on section if need due to retro-compatibility.

@param  array                $criteria           An array of criteria ( field => value ).
@param  array|null           $orderBy            Optional, an array of ordering criteria ( [field => direction] ).
@param  integer|null         $limit              Optional, the max number of results.
@param  integer|null         $offset             Optional, The starting index of results.

@return Page[]                                   An array of matching pages.
Finds entities by a set of criteria with automatic join on section if need due to retro - compatibility .