i got the following:
<a href="{{ path('_be_activatecategory', {'id': category.id, 'active': 1}) }}">Aktivieren</a>
creates
/backend/categories/activate/8/1
and then i got
<a href="{{ path('_category', {'id': category.id}) }}">
which creates
/category?id=1
see the difference? what i want is in the second case exactly like in the first:
/category/1
how can i manage this? why didnt the path() helper creates the correct url with parameters for me?
EDIT:
my routing looks like this:
/** * @Route("/category/{id}", name="_category") * @Template() */ public function categoryAction($id) {
Make sure your routing.yml
file has 'id'
specified in it. In other words, it should look like:
_category: path: /category/{id}
Set the default value for the active
argument in the route.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With