Reputation: 2793
My route has three parameter, userid is always required, a and b are optional parameter. Either a or (a and b) or (neither a nor b) may be given:
$app->get('/show/{userid}/{a}/{b}/', function($userid, $a,$b) use($app) {
...
})->value('a', 'defaultValueA')->value('b', 'defaultValueB');
So I want to match the following urls:
show/12345
show/12345/paramA
show/12345/paramA/paramB
My code only works for the last version where all parameters are given. What is wrong?
Update:
I started a brand new project and tested my approach again. Worked. I copied my .htaccess into the brand new project. Still worked. So my (very general) question is: What else could affect the routing in a Silex project?
Upvotes: 3
Views: 3851
Reputation: 2793
I was using the translation service in Silex and copied by accident too much from the usage example from http://silex.sensiolabs.org/doc/providers/translation.html into my code. So my route definition above was catched by this definition defined earlier in the set-up.
$app->get('/{_locale}/{message}/{name}', function ($message, $name) use ($app) {
return $app['translator']->trans($message, array('%name%' => $name)); });
Upvotes: 1