Skip to content

Commit bece514

Browse files
committed
minor #10470 Update conditions.rst (rapemer, javiereguiluz)
This PR was merged into the 4.1 branch. Discussion ---------- Update conditions.rst Undocumented functionality -> injecting container parameters into Route condition Commits ------- b506c94 Reword 9d84030 Update conditions.rst 3950895 Update conditions.rst 952b2ac Update conditions.rst a61eb88 Update conditions.rst
2 parents d0b1f61 + b506c94 commit bece514

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

routing/conditions.rst

+6
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;

0 commit comments

Comments
 (0)