Bundle/TwigBundle/Repository/ErrorPageRepository.php
public function findOneByCode($code, $deepMode = false)
    {
        //the query builder
        $page = $this->createQueryBuilder($this->mainAlias)
            ->where($this->mainAlias.'.code = :code')
            ->setParameter('code', $code)
            ->setMaxResults(1)
            ->getQuery()
            ->getOneOrNullResult();

        if (!$page && $deepMode) {
            // Check for a same family error
            // for example, for a 404 code, if the 404 error page doesn't exist, we check for a 400 errorPage
            $page = $this->findOneByCode(floor($code / 100) * 100);
        }

        return $page;
    }
public function findOneByCode($code, $deepMode = false)
    {
        //the query builder
        $page = $this->createQueryBuilder($this->mainAlias)
            ->where($this->mainAlias.'.code = :code')
            ->setParameter('code', $code)
            ->setMaxResults(1)
            ->getQuery()
            ->getOneOrNullResult();

        if (!$page && $deepMode) {
            // Check for a same family error
            // for example, for a 404 code, if the 404 error page doesn't exist, we check for a 400 errorPage
            $page = $this->findOneByCode(floor($code / 100) * 100);
        }

        return $page;
    }
public function findOneByCode ( $ code , $ deepMode = false ) { //the query builder $ page = $ this -> createQueryBuilder ( $ this -> mainAlias ) -> where ( $ this -> mainAlias . '.code = :code' ) -> setParameter ( 'code' , $ code ) -> setMaxResults ( 1 ) -> getQuery ( ) -> getOneOrNullResult ( ) ; if ( ! $ page && $ deepMode ) { // Check for a same family error // for example, for a 404 code, if the 404 error page doesn't exist, we check for a 400 errorPage $ page = $ this -> findOneByCode ( floor ( $ code / 100 ) * 100 ) ; } return $ page ; }
Get a page according to the given code.

@param int $code The error code

@return Page
Get a page according to the given code .