0

Color me confused. I'm getting this error intermittently.

[2015-02-16 10:29:51] request.INFO: Matched route "app_site_default_edittargetsubmit" (parameters: "_controller": "App\SiteBundle\Controller\DefaultController::editTargetSubmitAction", "id": "17", "_route": "app_site_default_edittargetsubmit") [] []
[2015-02-16 10:29:51] security.DEBUG: Read SecurityContext from the session [] []
[2015-02-16 10:29:51] security.DEBUG: Reloading user from user provider. [] []
[2015-02-16 10:29:51] security.DEBUG: Username "[email protected]" was reloaded from user provider. [] []
[2015-02-16 10:29:51] request.CRITICAL: Uncaught PHP Exception Symfony\Component\Routing\Exception\MissingMandatoryParametersException: "Some mandatory parameters are missing ("id") to generate a URL for route "adminCustomerTargets"." at /var/www/mysite/site/app/cache/prod/classes.php line 1264 {"exception":"[object] (Symfony\\Component\\Routing\\Exception\\MissingMandatoryParametersException: Some mandatory parameters are missing (\"id\") to generate a URL for route \"adminCustomerTargets\". at /var/www/ourbrightlink/site/app/cache/prod/classes.php:1264)"} []
[2015-02-16 10:29:51] security.DEBUG: Write SecurityContext in the session [] []

As you can see in the list of parameters in the first line of the exception, the id parameter is there. (parameters: "_controller": "App\SiteBundle\Controller\DefaultController::editTargetSubmitAction", "id": "17", "_route": "app_site_default_edittargetsubmit").

The route is defined via annotation:

  /**
   * Handles the submission of the Edit form.
   *
   * @route( "target/edit/{id}" )
   * @method( {"POST"} )
   * @template( "AppSiteBundle:Default:editTarget.html.twig" )
   * @param Request $request
   * @param  $id
   * @return \Symfony\Component\HttpFoundation\RedirectResponse
   */
  public function editTargetSubmitAction( Request $request, $id )
  { ... }

This is Symfony 2.5.6.

Suggestions? TIA

4
  • I noticed the @Route annotation is missing the route name, which in this case is app_site_default_edittargetsubmit. Have you defined this route name elsewhere? Commented Feb 19, 2015 at 16:37
  • I am using the default route name for this route. No. It isn't defined anywhere else. - Thanks Commented Feb 19, 2015 at 20:36
  • This is happening with other routes as well. In all cases, intermittently. Commented Feb 19, 2015 at 21:43
  • I may have found the answer to this at [link]stackoverflow.com/questions/13150543/…. I'll post when I know for sure. Commented Feb 19, 2015 at 22:51

1 Answer 1

2

The post noted above is, indeed, the answer. This error occurs not when matching a URL to a route, but when generating a URL from a route. This happens when the second parameter is absent in the call to generateUrl().

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.