getRequest() 공개 메소드

public getRequest ( ) : Request
리턴 Symfony\Component\HttpFoundation\Request
예제 #1
0
 public function onSiteAccessMatch(PostSiteAccessMatchEvent $event)
 {
     $request = $event->getRequest();
     $siteAccess = $event->getSiteAccess();
     // Injecting matched SiteAccess in the ServiceContainer.
     // All services depending on it will be "synchronized" with it.
     $this->container->set('ezpublish.siteaccess', $siteAccess);
     // We already have semanticPathinfo (sub-request)
     if ($request->attributes->has('semanticPathinfo')) {
         $vpString = $request->attributes->get('viewParametersString');
         if (!empty($vpString)) {
             $request->attributes->set('viewParameters', $this->generateViewParametersArray($vpString));
         } else {
             $request->attributes->set('viewParametersString', '');
             $request->attributes->set('viewParameters', array());
         }
         return;
     }
     // Analyse the pathinfo if needed since it might contain the siteaccess (i.e. like in URI mode)
     $pathinfo = $request->getPathInfo();
     if ($siteAccess->matcher instanceof URILexer) {
         $semanticPathinfo = $siteAccess->matcher->analyseURI($pathinfo);
     } else {
         $semanticPathinfo = $pathinfo;
     }
     // Get view parameters and cleaned up pathinfo (without view parameters string)
     list($semanticPathinfo, $viewParameters, $viewParametersString) = $this->getViewParameters($semanticPathinfo);
     // Storing the modified pathinfo in 'semanticPathinfo' request attribute, to keep a trace of it.
     // Routers implementing RequestMatcherInterface should thus use this attribute instead of the original pathinfo
     $request->attributes->set('semanticPathinfo', $semanticPathinfo);
     $request->attributes->set('viewParameters', $viewParameters);
     $request->attributes->set('viewParametersString', $viewParametersString);
 }
 public function onSiteAccessMatch(PostSiteAccessMatchEvent $event)
 {
     if (!$this->session || $event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) {
         return;
     }
     $sessionName = $this->session->getName();
     $request = $event->getRequest();
     if (!$this->session->isStarted() && !$request->hasPreviousSession() && $request->request->has($sessionName)) {
         $this->session->setId($request->request->get($sessionName));
         $this->session->start();
     }
 }