Bundle/PageBundle/Helper/PageHelper.php
public function findPageByReference($viewReference)
    {
        $page = null;
        if ($viewReference instanceof BusinessPageReference) {
            if ($viewReference->getViewId()) { //BusinessPage
                $page = $this->entityManager->getRepository('VictoireCoreBundle:View')
                    ->findOneBy([
                        'id' => $viewReference->getViewId(),
                    ]);
                $page->setCurrentLocale($viewReference->getLocale());
            } else { //VirtualBusinessPage
                $page = $this->entityManager->getRepository('VictoireCoreBundle:View')
                    ->findOneBy([
                        'id' => $viewReference->getTemplateId(),
                    ]);
                if ($entity = $this->findEntityByReference($viewReference)) {
                    if ($page instanceof BusinessTemplate) {
                        $page = $this->updatePageWithEntity($page, $entity);
                    }
                    if ($page instanceof BusinessPage) {
                        if ($page->getSeo()) {
                            $page->getSeo()->setCurrentLocale($viewReference->getLocale());
                        }
                        $this->pageSeoHelper->updateSeoByEntity($page, $entity);
                    }
                }
            }
        } elseif ($viewReference instanceof ViewReference) {
            $page = $this->entityManager->getRepository('VictoireCoreBundle:View')
                ->findOneBy([
                    'id' => $viewReference->getViewId(),
                ]);
            $page->setCurrentLocale($viewReference->getLocale());
        } else {
            throw new \Exception(sprintf('Oh no! Cannot find a page for this ViewReference (%s)', ClassUtils::getClass($viewReference)));
        }

        return $page;
    }
public function findPageByReference($viewReference)
    {
        $page = null;
        if ($viewReference instanceof BusinessPageReference) {
            if ($viewReference->getViewId()) { //BusinessPage
                $page = $this->entityManager->getRepository('VictoireCoreBundle:View')
                    ->findOneBy([
                        'id' => $viewReference->getViewId(),
                    ]);
                $page->setCurrentLocale($viewReference->getLocale());
            } else { //VirtualBusinessPage
                $page = $this->entityManager->getRepository('VictoireCoreBundle:View')
                    ->findOneBy([
                        'id' => $viewReference->getTemplateId(),
                    ]);
                if ($entity = $this->findEntityByReference($viewReference)) {
                    if ($page instanceof BusinessTemplate) {
                        $page = $this->updatePageWithEntity($page, $entity);
                    }
                    if ($page instanceof BusinessPage) {
                        if ($page->getSeo()) {
                            $page->getSeo()->setCurrentLocale($viewReference->getLocale());
                        }
                        $this->pageSeoHelper->updateSeoByEntity($page, $entity);
                    }
                }
            }
        } elseif ($viewReference instanceof ViewReference) {
            $page = $this->entityManager->getRepository('VictoireCoreBundle:View')
                ->findOneBy([
                    'id' => $viewReference->getViewId(),
                ]);
            $page->setCurrentLocale($viewReference->getLocale());
        } else {
            throw new \Exception(sprintf('Oh no! Cannot find a page for this ViewReference (%s)', ClassUtils::getClass($viewReference)));
        }

        return $page;
    }
public function findPageByReference ( $ viewReference ) { $ page = null ; if ( $ viewReference instanceof BusinessPageReference ) { if ( $ viewReference -> getViewId ( ) ) { //BusinessPage $ page = $ this -> entityManager -> getRepository ( 'VictoireCoreBundle:View' ) -> findOneBy ( [ 'id' => $ viewReference -> getViewId ( ) , ] ) ; $ page -> setCurrentLocale ( $ viewReference -> getLocale ( ) ) ; } else { //VirtualBusinessPage $ page = $ this -> entityManager -> getRepository ( 'VictoireCoreBundle:View' ) -> findOneBy ( [ 'id' => $ viewReference -> getTemplateId ( ) , ] ) ; if ( $ entity = $ this -> findEntityByReference ( $ viewReference ) ) { if ( $ page instanceof BusinessTemplate ) { $ page = $ this -> updatePageWithEntity ( $ page , $ entity ) ; } if ( $ page instanceof BusinessPage ) { if ( $ page -> getSeo ( ) ) { $ page -> getSeo ( ) -> setCurrentLocale ( $ viewReference -> getLocale ( ) ) ; } $ this -> pageSeoHelper -> updateSeoByEntity ( $ page , $ entity ) ; } } } } elseif ( $ viewReference instanceof ViewReference ) { $ page = $ this -> entityManager -> getRepository ( 'VictoireCoreBundle:View' ) -> findOneBy ( [ 'id' => $ viewReference -> getViewId ( ) , ] ) ; $ page -> setCurrentLocale ( $ viewReference -> getLocale ( ) ) ; } else { throw new \ Exception ( sprintf ( 'Oh no! Cannot find a page for this ViewReference (%s)' , ClassUtils :: getClass ( $ viewReference ) ) ) ; } return $ page ; }
find the page according to given url.

@return View
find the page according to given url .