Reputation: 1398
I want to ask you a little explanations of routing with annotations.
Is there a difference between
/**
*@Route("/{_locale"}
*/
and :
/**
*@Route("/{locale"}
*/
Thanks !
Upvotes: 0
Views: 40
Reputation:
Certain parameters with an underscore in a route have special meaning for the resulting Request
object. So your first route will change the locale setting, such that you can do $request->getLocale()
, while your second route will set a parameter called locale e.g. $request->get('locale')
. Special parameters can have a knock on effect for the rest of your application e.g. setting the response format.
The different "special" routing parameters are detailed in the routing documentation. Both are syntactically correct.
Upvotes: 1