Symfony Exception

MissingMandatoryParametersException

HTTP 500 Internal Server Error

Some mandatory parameters are missing ("slug") to generate a URL for route "product_show".

Exception

Symfony\Component\Routing\Exception\ MissingMandatoryParametersException

  1.         $variables array_flip($variables);
  2.         $mergedParams array_replace($defaults$this->context->getParameters(), $parameters);
  3.         // all params must be given
  4.         if ($diff array_diff_key($variables$mergedParams)) {
  5.             throw new MissingMandatoryParametersException(sprintf('Some mandatory parameters are missing ("%s") to generate a URL for route "%s".'implode('", "'array_keys($diff)), $name));
  6.         }
  7.         $url '';
  8.         $optional true;
  9.         $message 'Parameter "{parameter}" for route "{route}" must match "{expected}" ("{given}" given) to generate a corresponding URL.';
  1.             throw new RouteNotFoundException(sprintf('Unable to generate a URL for the named route "%s" as such route does not exist.'$name));
  2.         }
  3.         list($variables$defaults$requirements$tokens$hostTokens$requiredSchemes) = self::$declaredRoutes[$name];
  4.         return $this->doGenerate($variables$defaults$requirements$tokens$parameters$name$referenceType$hostTokens$requiredSchemes);
  5.     }
  6. }
in vendor/symfony/routing/Router.php->generate (line 240)
  1.     /**
  2.      * {@inheritdoc}
  3.      */
  4.     public function generate($name$parameters = array(), $referenceType self::ABSOLUTE_PATH)
  5.     {
  6.         return $this->getGenerator()->generate($name$parameters$referenceType);
  7.     }
  8.     /**
  9.      * {@inheritdoc}
  10.      */
  1.      *
  2.      * @final
  3.      */
  4.     protected function generateUrl(string $route, array $parameters = array(), int $referenceType UrlGeneratorInterface::ABSOLUTE_PATH): string
  5.     {
  6.         return $this->container->get('router')->generate($route$parameters$referenceType);
  7.     }
  8.     /**
  9.      * Forwards the request to another controller.
  10.      *
  1.      *
  2.      * @final
  3.      */
  4.     protected function redirectToRoute(string $route, array $parameters = array(), int $status 302): RedirectResponse
  5.     {
  6.         return $this->redirect($this->generateUrl($route$parameters), $status);
  7.     }
  8.     /**
  9.      * Returns a JsonResponse that uses the serializer component if enabled, or json_encode.
  10.      *
Controller->redirectToRoute('product_show', array('oldId' => '9759')) in src/Controller/LegacyController.php (line 22)
  1.      * @Method("GET")
  2.      */
  3.     public function titleAction(Request $request)
  4.     {
  5.         $oldId $request->get('id');
  6.         return $this->redirectToRoute('product_show', ['oldId' => $oldId]);
  7.     }
  8.     /**
  9.      * @Route("/asp/buchsuch.php", name="legacy_search")
  10.      * @Method("GET")
in vendor/symfony/http-kernel/HttpKernel.php->titleAction (line 150)
  1.         $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS$event);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new GetResponseForControllerResultEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch(KernelEvents::VIEW$event);
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level'ob_get_level());
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
Kernel->handle(object(Request)) in public/index.php (line 37)
  1.     Request::setTrustedHosts(explode(','$trustedHosts));
  2. }
  3. $kernel = new Kernel($env$debug);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Logs

No log messages

Stack Trace

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' => '9759'), 'product_show', 1, array(), array())
     (var/cache/production/srcApp_KernelProductionDebugContainerUrlGenerator.php:123)
  at srcApp_KernelProductionDebugContainerUrlGenerator->generate('product_show', array('oldId' => '9759'), 1)
     (vendor/symfony/routing/Router.php:240)
  at Symfony\Component\Routing\Router->generate('product_show', array('oldId' => '9759'), 1)
     (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:78)
  at Symfony\Bundle\FrameworkBundle\Controller\Controller->generateUrl('product_show', array('oldId' => '9759'))
     (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:114)
  at Symfony\Bundle\FrameworkBundle\Controller\Controller->redirectToRoute('product_show', array('oldId' => '9759'))
     (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)