Skip to content

Commit b506c94

Browse files
Reword
1 parent 9d84030 commit b506c94

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

routing/conditions.rst

+6-5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ define arbitrary matching logic, use the ``conditions`` routing option:
1717
path: /contact
1818
controller: 'App\Controller\DefaultController::contact'
1919
condition: "context.getMethod() in ['GET', 'HEAD'] and request.headers.get('User-Agent') matches '/firefox/i'"
20+
# expressions can also include config parameters
21+
# condition: "request.headers.get('User-Agent') matches '%app.allowed_browsers%'"
2022
2123
.. code-block:: xml
2224
@@ -30,6 +32,8 @@ define arbitrary matching logic, use the ``conditions`` routing option:
3032
<route id="contact" path="/contact">
3133
<default key="_controller">App\Controller\DefaultController::contact</default>
3234
<condition>context.getMethod() in ['GET', 'HEAD'] and request.headers.get('User-Agent') matches '/firefox/i'</condition>
35+
<!-- expressions can also include config parameters -->
36+
<!-- <condition>request.headers.get('User-Agent') matches '%app.allowed_browsers%'</condition> -->
3337
</route>
3438
</routes>
3539
@@ -50,6 +54,8 @@ define arbitrary matching logic, use the ``conditions`` routing option:
5054
array(),
5155
array(),
5256
'context.getMethod() in ["GET", "HEAD"] and request.headers.get("User-Agent") matches "/firefox/i"'
57+
// expressions can also include config parameters
58+
// 'request.headers.get("User-Agent") matches "%app.allowed_browsers%"'
5359
));
5460
5561
return $collection;
@@ -87,8 +93,3 @@ variables that are passed into the expression:
8793

8894
Because of this, using the ``condition`` key causes no extra overhead
8995
beyond the time it takes for the underlying PHP to execute.
90-
91-
Injecting parameters
92-
---------------------
93-
94-
You can inject container parameters (e.g. ``%kernel.environment%``) into condition, such as ``@Route(condition="'%kernel.environment%' in ['dev']")`` or any other you want.

0 commit comments

Comments
 (0)