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;
    }