public function homeAction(Request $request)
    {
        /** @var BlockManager $manager */
        $manager  = $this->get('opifer.content.content_manager');
        $host = $request->getHost();
        $em = $this->getDoctrine()->getManager();

        $siteCount = $em->getRepository(Site::class)->createQueryBuilder('s')
            ->select('count(s.id)')
            ->getQuery()
            ->getSingleScalarResult();

        $domain = $em->getRepository(Domain::class)->findOneByDomain($host);

        if ($siteCount && $domain->getSite()->getDefaultLocale()) {
            $request->setLocale($domain->getSite()->getDefaultLocale()->getLocale());
        }

        if (!$domain && $siteCount > 1) {
            return $this->render('OpiferContentBundle:Content:domain_not_found.html.twig');
        }

        $content = $manager->getRepository()->findActiveBySlug('index', $host);

        return $this->forward('OpiferContentBundle:Frontend/Content:view', [
            'content' => $content
        ]);
    }
public function homeAction(Request $request)
    {
        /** @var BlockManager $manager */
        $manager  = $this->get('opifer.content.content_manager');
        $host = $request->getHost();
        $em = $this->getDoctrine()->getManager();

        $siteCount = $em->getRepository(Site::class)->createQueryBuilder('s')
            ->select('count(s.id)')
            ->getQuery()
            ->getSingleScalarResult();

        $domain = $em->getRepository(Domain::class)->findOneByDomain($host);

        if ($siteCount && $domain->getSite()->getDefaultLocale()) {
            $request->setLocale($domain->getSite()->getDefaultLocale()->getLocale());
        }

        if (!$domain && $siteCount > 1) {
            return $this->render('OpiferContentBundle:Content:domain_not_found.html.twig');
        }

        $content = $manager->getRepository()->findActiveBySlug('index', $host);

        return $this->forward('OpiferContentBundle:Frontend/Content:view', [
            'content' => $content
        ]);
    }
public function homeAction ( Request $ request ) { /** @var BlockManager $manager */ $ manager = $ this -> get ( 'opifer.content.content_manager' ) ; $ host = $ request -> getHost ( ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ siteCount = $ em -> getRepository ( Site :: class ) -> createQueryBuilder ( 's' ) -> select ( 'count(s.id)' ) -> getQuery ( ) -> getSingleScalarResult ( ) ; $ domain = $ em -> getRepository ( Domain :: class ) -> findOneByDomain ( $ host ) ; if ( $ siteCount && $ domain -> getSite ( ) -> getDefaultLocale ( ) ) { $ request -> setLocale ( $ domain -> getSite ( ) -> getDefaultLocale ( ) -> getLocale ( ) ) ; } if ( ! $ domain && $ siteCount > 1 ) { return $ this -> render ( 'OpiferContentBundle:Content:domain_not_found.html.twig' ) ; } $ content = $ manager -> getRepository ( ) -> findActiveBySlug ( 'index' , $ host ) ; return $ this -> forward ( 'OpiferContentBundle:Frontend/Content:view' , [ 'content' => $ content ] ) ; }
Render the home page.

@param Request $request
@return Response
Render the home page .