/**
  * Base fallback action.
  * Will be basically used for every legacy module.
  *
  * @return \eZ\Bundle\EzPublishLegacyBundle\LegacyResponse
  */
 public function indexAction()
 {
     $kernelClosure = $this->kernelClosure;
     /** @var \eZ\Publish\Core\MVC\Legacy\Kernel $kernel */
     $kernel = $kernelClosure();
     $legacyMode = $this->configResolver->getParameter('legacy_mode');
     //Empêche le front d'aller dans de l'eZ legacy
     if (!$legacyMode && substr($this->request->getPathInfo(), 0, 18) != '/content/download/') {
         throw new NotFoundHttpException('Adresse non trouvée');
     }
     $kernel->setUseExceptions(false);
     // Fix up legacy URI with current request since we can be in a sub-request here.
     $this->uriHelper->updateLegacyURI($this->request);
     // If we have a layout for legacy AND we're not in legacy mode, we ask the legacy kernel not to generate layout.
     if (isset($this->legacyLayout) && !$legacyMode) {
         $kernel->setUsePagelayout(false);
     }
     $result = $kernel->run();
     $kernel->setUseExceptions(true);
     if ($result instanceof ezpKernelRedirect) {
         return $this->legacyResponseManager->generateRedirectResponse($result);
     }
     $this->legacyHelper->loadDataFromModuleResult($result->getAttribute('module_result'));
     $response = $this->legacyResponseManager->generateResponseFromModuleResult($result);
     $this->legacyResponseManager->mapHeaders(headers_list(), $response);
     return $response;
 }
Beispiel #2
0
 public function testFixupInternalURIPathinfo()
 {
     $initialURI = '/foo/bar/baz';
     $request = Request::create($initialURI);
     $helper = new URIHelper();
     $helper->updateLegacyURI($request);
     $this->assertSame($initialURI, eZURI::instance()->uriString(true));
 }