/**
  * on kernel finish request.
  *
  * @param FinishRequestEvent $event
  */
 public function onKernelFinishRequest(FinishRequestEvent $event)
 {
     if (null === ($parentRequest = $this->requestStack->getParentRequest())) {
         return;
     }
     $this->setLocale($parentRequest);
 }
 /**
  * @return string
  */
 public function getLayout($layout = 'base')
 {
     $request = $this->requestStack->getCurrentRequest();
     if (null !== $request && $this->pjax->isPjaxRequest($request) || null !== $this->requestStack->getParentRequest()) {
         return $this->layouts['pjax'];
     }
     return $this->layouts[$layout];
 }
 public function testGetParentRequest()
 {
     $requestStack = new RequestStack();
     $this->assertNull($requestStack->getParentRequest());
     $masterRequest = Request::create('/foo');
     $requestStack->push($masterRequest);
     $this->assertNull($requestStack->getParentRequest());
     $firstSubRequest = Request::create('/bar');
     $requestStack->push($firstSubRequest);
     $this->assertSame($masterRequest, $requestStack->getParentRequest());
     $secondSubRequest = Request::create('/baz');
     $requestStack->push($secondSubRequest);
     $this->assertSame($firstSubRequest, $requestStack->getParentRequest());
 }
Exemple #4
0
 /**
  * {@inheritdoc}
  */
 public function getParentRouteMatch()
 {
     return $this->getRouteMatch($this->requestStack->getParentRequest());
 }
 /**
  * Get the parent request.
  *
  * @return Request|null
  */
 public function getParentRequest()
 {
     return $this->requestStack->getParentRequest();
 }