Routing in Symfony2: optional parameter en four urls for one route
问题 In my Symfony2 application I would like to make four urls possible with one route: a-lot-of-other-stuff/report/-20 (negative number) a-lot-of-other-stuff/report/40 (positive number) a-lot-of-other-stuff/report/ (no number) a-lot-of-other-stuff/report (no number and no / ) My route currently looks like this: report: pattern: /report/{days} defaults: { _controller: "AppReportBundle:Report:dayReport", days = null } The action is defined as: public function dayReportAction($days = null) { // my