$variables = array_flip($variables);
$mergedParams = array_replace($defaults, $this->context->getParameters(), $parameters);
// all params must be given
if ($diff = array_diff_key($variables, $mergedParams)) {
throw new MissingMandatoryParametersException(sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".', implode('", "', array_keys($diff)), $name));
}
$url = '';
$optional = true;
$message = 'Parameter "{parameter}" for route "{route}" must match "{expected}" ("{given}" given) to generate a corresponding URL.';
throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.', $name));
}
list($variables, $defaults, $requirements, $tokens, $hostTokens, $requiredSchemes) = self::$declaredRoutes[$name];
return $this->doGenerate($variables, $defaults, $requirements, $tokens, $parameters, $name, $referenceType, $hostTokens, $requiredSchemes);
}
}
*
* @final
*/
protected function redirectToRoute(string $route, array $parameters = array(), int $status = 302): RedirectResponse
{
return $this->redirect($this->generateUrl($route, $parameters), $status);
}
/**
* Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
*
$this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS, $event);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new GetResponseForControllerResultEvent($this, $request, $type, $response);
$this->dispatcher->dispatch(KernelEvents::VIEW, $event);
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
$request->headers->set('X-Php-Ob-Level', 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) {
No log messages
MissingMandatoryParametersException |
---|
Symfony\Component\Routing\Exception\MissingMandatoryParametersException: Some mandatory parameters are missing ("slug") to generate a URL for route "product_show". at vendor/symfony/routing/Generator/UrlGenerator.php:151 at Symfony\Component\Routing\Generator\UrlGenerator->doGenerate(array('slug' => 0), array('_controller' => 'App\\Controller\\ProductController::showAction'), array('slug' => '(?!suche|search|_wdt).+'), array(array('variable', '/', '(?!suche|search|_wdt).+', 'slug'), array('text', '/titel')), array('oldId' => '10061'), 'product_show', 1, array(), array()) (var/cache/production/srcApp_KernelProductionDebugContainerUrlGenerator.php:123) at srcApp_KernelProductionDebugContainerUrlGenerator->generate('product_show', array('oldId' => '10061'), 1) (vendor/symfony/routing/Router.php:240) at Symfony\Component\Routing\Router->generate('product_show', array('oldId' => '10061'), 1) (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:78) at Symfony\Bundle\FrameworkBundle\Controller\Controller->generateUrl('product_show', array('oldId' => '10061')) (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:114) at Symfony\Bundle\FrameworkBundle\Controller\Controller->redirectToRoute('product_show', array('oldId' => '10061')) (src/Controller/LegacyController.php:22) at App\Controller\LegacyController->titleAction(object(Request)) (vendor/symfony/http-kernel/HttpKernel.php:150) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/http-kernel/HttpKernel.php:67) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/Kernel.php:198) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (public/index.php:37) |