protected function render(string $view, array $parameters = [], Response $response = null): Response
{
if ($this->container->has('templating')) {
@trigger_error('Using the "templating" service is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
$content = $this->container->get('templating')->render($view, $parameters);
} elseif ($this->container->has('twig')) {
$content = $this->container->get('twig')->render($view, $parameters);
} else {
throw new \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available. Try running "composer require symfony/twig-bundle".');
}
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
RuntimeException |
---|
RuntimeException: No engine is able to work with the template "countries/index.html.twig". at vendor/symfony/templating/DelegatingEngine.php:101 at Symfony\Component\Templating\DelegatingEngine->getEngine() (vendor/symfony/framework-bundle/Templating/DelegatingEngine.php:44) at Symfony\Bundle\FrameworkBundle\Templating\DelegatingEngine->getEngine() (vendor/symfony/templating/DelegatingEngine.php:41) at Symfony\Component\Templating\DelegatingEngine->render() (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:233) at Symfony\Bundle\FrameworkBundle\Controller\Controller->render() (src/Controller/CountriesController.php:16) at App\Controller\CountriesController->index() (vendor/symfony/http-kernel/HttpKernel.php:158) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor/symfony/http-kernel/HttpKernel.php:80) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor/symfony/http-kernel/Kernel.php:201) at Symfony\Component\HttpKernel\Kernel->handle() (public/index.php:36) |