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

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

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

        return $query->getQuery()
                        ->getOneOrNullResult();
    }
public function findOneBy(array $criteria, array $orderBy = null)
    {
        if (
                false === PageQueryBuilder::hasJoinCriteria($criteria) &&
                false === PageQueryBuilder::hasJoinCriteria($orderBy)
        ) {
            return parent::findOneBy($criteria, $orderBy);
        }

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

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

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

@param  array                $criteria           An array of criteria.
@param  array|null           $orderBy            Optional, an array of ordering criteria.

@return object|null                              The page instance or null if the entity can not be found.
Finds a single entity by a set of criteria with automatic join on section if need due to retro - compatibility .