How to pass boolean default value in router?
-
25-10-2019 - |
Question
Let's say I have a history portal and I got something like this in my router:
article/{century}/{decade}/{year}/{month}/{day}
The problem is that my controller have boolean default values for all these variables (false), because the business logic should decide what to show without specifying a date.
How can I do this without specifying multiple routes for this?
Solution
* @Route("article/{century}/{decade}/...", defaults={"century"="false", "decade"="false", ...})
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow