Sulu\Bundle\PreviewBundle\Preview\Renderer\KernelFactoryInterface::create PHP Method

create() public method

Create new kernel for a single preview master-request.
public create ( string $environment ) : Symfony\Component\HttpKernel\KernelInterface
$environment string
return Symfony\Component\HttpKernel\KernelInterface
    public function create($environment);

Usage Example

Example #1
0
 /**
  * Handles given request and returns response.
  *
  * @param Request $request
  *
  * @return Response
  *
  * @throws \Exception
  */
 private function handle(Request $request)
 {
     $kernel = $this->kernelFactory->create($this->environment);
     try {
         return $kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, false);
     } catch (HttpException $e) {
         if ($e->getPrevious()) {
             throw $e->getPrevious();
         }
         throw $e;
     }
 }
KernelFactoryInterface