Bundle/CoreBundle/Repository/ViewRepository.php
public function findOneByHomepage($locale = 'fr')
    {
        //the query builder
        $qb = $this->getInstance();
        $qb
            ->where($this->mainAlias.'.homepage = true')
            ->andWhere($this->mainAlias.'.status = :status')
            ->setMaxResults(1)
            ->setParameter('status', PageStatus::PUBLISHED);
        // Use Translation Walker
        $query = $qb->getQuery();
        $view = $query->getOneOrNullResult();
        $view->translate($locale);

        return $view;
    }
public function findOneByHomepage($locale = 'fr')
    {
        //the query builder
        $qb = $this->getInstance();
        $qb
            ->where($this->mainAlias.'.homepage = true')
            ->andWhere($this->mainAlias.'.status = :status')
            ->setMaxResults(1)
            ->setParameter('status', PageStatus::PUBLISHED);
        // Use Translation Walker
        $query = $qb->getQuery();
        $view = $query->getOneOrNullResult();
        $view->translate($locale);

        return $view;
    }
public function findOneByHomepage ( $ locale = 'fr' ) { //the query builder $ qb = $ this -> getInstance ( ) ; $ qb -> where ( $ this -> mainAlias . '.homepage = true' ) -> andWhere ( $ this -> mainAlias . '.status = :status' ) -> setMaxResults ( 1 ) -> setParameter ( 'status' , PageStatus :: PUBLISHED ) ; // Use Translation Walker $ query = $ qb -> getQuery ( ) ; $ view = $ query -> getOneOrNullResult ( ) ; $ view -> translate ( $ locale ) ; return $ view ; }
Get the view that is a page and a published one.

@param string $locale

@return Page
Get the view that is a page and a published one .