src/Listener/RequestListener.php
public function onCoreRequest(GetResponseEvent $event)
    {
        $request = $event->getRequest();

        $cms = $this->cmsSelector->retrieve();
        if (!$cms) {
            throw new InternalErrorException('No CMS Manager available');
        }

        // true cms page
        if (PageInterface::PAGE_ROUTE_CMS_NAME === $request->get('_route')) {
            return;
        }

        if (!$this->decoratorStrategy->isRequestDecorable($request)) {
            return;
        }

        $site = $this->siteSelector->retrieve();

        if (!$site) {
            throw new InternalErrorException('No site available for the current request with uri '.htmlspecialchars($request->getUri(), ENT_QUOTES));
        }

        if ($site->getLocale() && $site->getLocale() !== $request->get('_locale')) {
            throw new PageNotFoundException(sprintf('Invalid locale - site.locale=%s - request._locale=%s', $site->getLocale(), $request->get('_locale')));
        }

        try {
            $page = $cms->getPageByRouteName($site, $request->get('_route'));

            if (!$page->getEnabled() && !$this->cmsSelector->isEditor()) {
                throw new PageNotFoundException(sprintf('The page is not enabled : id=%s', $page->getId()));
            }

            $cms->setCurrentPage($page);
        } catch (PageNotFoundException $e) {
            return;
        }
    }
public function onCoreRequest(GetResponseEvent $event)
    {
        $request = $event->getRequest();

        $cms = $this->cmsSelector->retrieve();
        if (!$cms) {
            throw new InternalErrorException('No CMS Manager available');
        }

        // true cms page
        if (PageInterface::PAGE_ROUTE_CMS_NAME === $request->get('_route')) {
            return;
        }

        if (!$this->decoratorStrategy->isRequestDecorable($request)) {
            return;
        }

        $site = $this->siteSelector->retrieve();

        if (!$site) {
            throw new InternalErrorException('No site available for the current request with uri '.htmlspecialchars($request->getUri(), ENT_QUOTES));
        }

        if ($site->getLocale() && $site->getLocale() !== $request->get('_locale')) {
            throw new PageNotFoundException(sprintf('Invalid locale - site.locale=%s - request._locale=%s', $site->getLocale(), $request->get('_locale')));
        }

        try {
            $page = $cms->getPageByRouteName($site, $request->get('_route'));

            if (!$page->getEnabled() && !$this->cmsSelector->isEditor()) {
                throw new PageNotFoundException(sprintf('The page is not enabled : id=%s', $page->getId()));
            }

            $cms->setCurrentPage($page);
        } catch (PageNotFoundException $e) {
            return;
        }
    }
public function onCoreRequest ( GetResponseEvent $ event ) { $ request = $ event -> getRequest ( ) ; $ cms = $ this -> cmsSelector -> retrieve ( ) ; if ( ! $ cms ) { throw new InternalErrorException ( 'No CMS Manager available' ) ; } // true cms page if ( PageInterface :: PAGE_ROUTE_CMS_NAME === $ request -> get ( '_route' ) ) { return ; } if ( ! $ this -> decoratorStrategy -> isRequestDecorable ( $ request ) ) { return ; } $ site = $ this -> siteSelector -> retrieve ( ) ; if ( ! $ site ) { throw new InternalErrorException ( 'No site available for the current request with uri ' . htmlspecialchars ( $ request -> getUri ( ) , ENT_QUOTES ) ) ; } if ( $ site -> getLocale ( ) && $ site -> getLocale ( ) !== $ request -> get ( '_locale' ) ) { throw new PageNotFoundException ( sprintf ( 'Invalid locale - site.locale=%s - request._locale=%s' , $ site -> getLocale ( ) , $ request -> get ( '_locale' ) ) ) ; } try { $ page = $ cms -> getPageByRouteName ( $ site , $ request -> get ( '_route' ) ) ; if ( ! $ page -> getEnabled ( ) && ! $ this -> cmsSelector -> isEditor ( ) ) { throw new PageNotFoundException ( sprintf ( 'The page is not enabled : id=%s' , $ page -> getId ( ) ) ) ; } $ cms -> setCurrentPage ( $ page ) ; } catch ( PageNotFoundException $ e ) { return ; } }
Filter the `core.request` event to decorated the action.

@param GetResponseEvent $event

@throws InternalErrorException
@throws PageNotFoundException
Filter the core . request event to decorated the action .