*
* throw $this->createNotFoundException('Page not found!');
*/
protected function createNotFoundException(string $message = 'Not Found', ?\Throwable $previous = null): NotFoundHttpException
{
return new NotFoundHttpException($message, $previous);
}
/**
* Returns an AccessDeniedException.
*
foreach ($flatpagesTemplateList as $template) {
if ($this->translator->trans($template) == $pagename) {
return $template;
}
}
throw $this->createNotFoundException();
}
}
* @return Response
*/
public function index(Request $request, UnauthorizedReferenceRepository $referenceRepository, $pagename)
{
/* récupère le nom du template a partir du nom de page fourni $pagename */
$pagename = $this->getTemplate($pagename);
$viewParams = [
'bodyClass' => 'flatpage_' . $pagename,
'bodyAdditionalClass' => 'noHeaderImg',
'headerClass' => 'noHeaderImg',
$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);
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
$this->boot();
++$this->requestStackSize;
$this->resetServices = true;
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
No log messages
NotFoundHttpException
|
---|
Symfony\Component\HttpKernel\Exception\NotFoundHttpException: Not Found at vendor/symfony/framework-bundle/Controller/AbstractController.php:340 at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->createNotFoundException() (src/Controller/Web/FlatPageController.php:71) at App\Controller\Web\FlatPageController->getTemplate('www.ecocert.ch') (src/Controller/Web/FlatPageController.php:27) at App\Controller\Web\FlatPageController->index(object(Request), object(UnauthorizedReferenceRepository), 'www.ecocert.ch') (vendor/symfony/http-kernel/HttpKernel.php:163) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/http-kernel/HttpKernel.php:75) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/Kernel.php:202) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (public/index.php:25) |