Answer the question
In order to leave comments, you need to log in
How to set dependent parameters for routes in Symfony annotations?
Let's say we have the following urls:
/page/
- is optional. Those. if there is no page number following it, just example.com/products/ should be used ?
Answer the question
In order to leave comments, you need to log in
Specify page as {slug} too. And set its default value and required value to only page.
@Route("/products/{page}/{pageNum}", name="product_paged_index", defaults={"page":"page", "pageNum": "1"}, requirements={"page"="page", "pageNum"="\d+"})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question