Reputation: 9900
My Symfony app has an existing route, log/add
which calls the function addAction
successfully.
Recently I've had to add a variant of that route which has a timestamp at the end like so, log/add/1429228800
. What I need is for the second route to point at the same action as the first.
My issue is the second route generates the following error:
No route found for "GET /log/add/1429228800"
My routes are set in yml like the following:
log_add:
pattern: /log/add
defaults: { _controller: MyBundle:Default:add }
log_add_timestamped:
pattern: /log/add/{timestamp}
defaults: { _controller: MyBundle:Default:add }
Upvotes: 1
Views: 443
Reputation: 608
You only need one route
log_add:
pattern: /log/add/{timestamp}
defaults: { _controller: MyBundle:Default:add, timestamp: null}
Set a default value to the timestamp parameter (null
in my example, but you can set something else)
Upvotes: 1