Twig path () function generating different results
I am trying to add dynamic links to my branch template by calling path () with a parameter.
{{ path('single_sale_submit_page', {'id': book['id']}) }}
I am using annotation in my controller:
@Route("/book/{id}", name="single_sale_submit_page")
This results in the following URL: ../ book /? Id = 123456789. I keep getting the error that my controller needs a required parameter, which of course is true because the generated url has a different syntax (?).
How to set up a branch so that the generated url from path () matches
../book/123456789
but not
../book/?id=123456789
EDIT: This question has the same question as mine.
+3
source to share
1 answer