Answer the question
In order to leave comments, you need to log in
How to make a route (routing) parameter optional in Symfony 2?
Let's say we have a route like this:
feedback:
pattern: /{_locale)/feedback
defaults: { _controller: AcmeHelloBundle:Feedback:index }
requirements:
_locale: en|ru
Answer the question
In order to leave comments, you need to log in
the locale must be used as a prefix
you_route:
resource: "@CustomBundle/Resources/config/routing.yml"
prefix: /{_locale}
requirements:
_locale: en|ru
defaults: { _locale: en}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question