0

In silex I have something like

$controllers->get('/{id}', 'Controllers\\Login::index')->bind('login');

when in twig I try to get path('login') I get exception

("Some mandatory parameters are missing ("id") to generate a URL for route "login"."). ?

I know this is because of {id} and I have to pass a second parameter to path() but how should it look like?

Joe Hark
  • 155
  • 1
  • 3
  • 10
  • Possible duplicate of [Add more than one parameter in Twig path](https://stackoverflow.com/questions/10382093/add-more-than-one-parameter-in-twig-path) this link explain how to pass parameters to path method in twig – olibiaz Nov 08 '17 at 22:15

1 Answers1

1

In order to pass parameters to twig path, use the following syntax:

{{ path('login', {'id': 'your-id-here'}) }}

you can have a look at the documentation here:

Path() function documentation, symfony

You can pass several parameters as explained here:

SO: several paremeters in twig

olibiaz
  • 2,551
  • 4
  • 29
  • 31