-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[Routing] Added a note about defining route requirements in the container #1827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -612,6 +612,16 @@ the regular expression ``(en|fr)``. | |
| /es | *won't match this route* | | ||
+-----+--------------------------+ | ||
|
||
.. sidebar:: Requirements defined in the container | ||
|
||
If for some reason you need to define some configurable requirements, | ||
you can use a parameter from the service container. For instance, if you | ||
have a _locale parameter in the routes and you like it to be configurable, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be
|
||
you can do this: requirements: _locale: %locale% | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to create a code block here or, even better, a configuration block with all formats:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I add just a note, but you are right. Maybe it should be better if instead a note I add a section, then I will be able to add the configuration block. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First of all, this isn't a note nor a section. It is a sidebare article, maybe a Secondly, you can use configuration blocks/code blocks/what you want inside notes/sidebar articles, the Rst isn't limited on the syntax. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the tip @wouterj. I'll do what you say. |
||
|
||
Then just define in the container a locale parameter. This is quite useful | ||
if you don't want to search all your code only to change a simple requirement. | ||
|
||
.. index:: | ||
single: Routing; Method requirement | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not good in English grammar, but I think this should be:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Me neither, I'm Cuban and I speak Spanish. Probably you are right. Thanks.