From a61eb8839b54e9c98d06085694579ab56d354cb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Brz=C3=A1k?= Date: Wed, 10 Oct 2018 15:48:52 +0200 Subject: [PATCH 1/5] Update conditions.rst Undocumented functionality -> injecting container parameters into Route condition --- routing/conditions.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/routing/conditions.rst b/routing/conditions.rst index 2e0d34b2da3..dd80d5685f6 100644 --- a/routing/conditions.rst +++ b/routing/conditions.rst @@ -87,3 +87,7 @@ variables that are passed into the expression: Because of this, using the ``condition`` key causes no extra overhead beyond the time it takes for the underlying PHP to execute. + +.. parameters-block:: Injecting parameters + + You can inject container parameters (e.g. `%kernel.environment%`) into condition, such as `@Route(condition="'%kernel.environment' in ['dev']")` or any other you want. From 952b2ac0841006be0ed7eeed8099a4f391f859a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Brz=C3=A1k?= Date: Wed, 10 Oct 2018 22:45:06 +0200 Subject: [PATCH 2/5] Update conditions.rst --- routing/conditions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routing/conditions.rst b/routing/conditions.rst index dd80d5685f6..4d3c16f0162 100644 --- a/routing/conditions.rst +++ b/routing/conditions.rst @@ -90,4 +90,4 @@ variables that are passed into the expression: .. parameters-block:: Injecting parameters - You can inject container parameters (e.g. `%kernel.environment%`) into condition, such as `@Route(condition="'%kernel.environment' in ['dev']")` or any other you want. + You can inject container parameters (e.g. `%kernel.environment%`) into condition, such as `@Route(condition="'%kernel.environment%' in ['dev']")` or any other you want. From 39508955e2171d49162669eead2c6df1e5628d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Brz=C3=A1k?= Date: Wed, 10 Oct 2018 22:48:32 +0200 Subject: [PATCH 3/5] Update conditions.rst --- routing/conditions.rst | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/routing/conditions.rst b/routing/conditions.rst index 4d3c16f0162..45158b416c1 100644 --- a/routing/conditions.rst +++ b/routing/conditions.rst @@ -88,6 +88,9 @@ variables that are passed into the expression: Because of this, using the ``condition`` key causes no extra overhead beyond the time it takes for the underlying PHP to execute. -.. parameters-block:: Injecting parameters +.. _parameters: - You can inject container parameters (e.g. `%kernel.environment%`) into condition, such as `@Route(condition="'%kernel.environment%' in ['dev']")` or any other you want. +Injecting parameters +--------------------- + + You can inject container parameters (e.g. ``%kernel.environment%``) into condition, such as ``@Route(condition="'%kernel.environment%' in ['dev']")`` or any other you want. From 9d84030cf7b4a2156f2eaa121bef183461a3e234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Brz=C3=A1k?= Date: Thu, 11 Oct 2018 12:55:26 +0200 Subject: [PATCH 4/5] Update conditions.rst --- routing/conditions.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/routing/conditions.rst b/routing/conditions.rst index 45158b416c1..fbb150bf61f 100644 --- a/routing/conditions.rst +++ b/routing/conditions.rst @@ -88,8 +88,6 @@ variables that are passed into the expression: Because of this, using the ``condition`` key causes no extra overhead beyond the time it takes for the underlying PHP to execute. -.. _parameters: - Injecting parameters --------------------- From b506c94da93274e7c282d9f53ab6886954cb3a40 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 17 Oct 2018 09:58:16 +0200 Subject: [PATCH 5/5] Reword --- routing/conditions.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/routing/conditions.rst b/routing/conditions.rst index fbb150bf61f..b7574dd2158 100644 --- a/routing/conditions.rst +++ b/routing/conditions.rst @@ -17,6 +17,8 @@ define arbitrary matching logic, use the ``conditions`` routing option: path: /contact controller: 'App\Controller\DefaultController::contact' condition: "context.getMethod() in ['GET', 'HEAD'] and request.headers.get('User-Agent') matches '/firefox/i'" + # expressions can also include config parameters + # condition: "request.headers.get('User-Agent') matches '%app.allowed_browsers%'" .. code-block:: xml @@ -30,6 +32,8 @@ define arbitrary matching logic, use the ``conditions`` routing option: App\Controller\DefaultController::contact context.getMethod() in ['GET', 'HEAD'] and request.headers.get('User-Agent') matches '/firefox/i' + + @@ -50,6 +54,8 @@ define arbitrary matching logic, use the ``conditions`` routing option: array(), array(), 'context.getMethod() in ["GET", "HEAD"] and request.headers.get("User-Agent") matches "/firefox/i"' + // expressions can also include config parameters + // 'request.headers.get("User-Agent") matches "%app.allowed_browsers%"' )); return $collection; @@ -87,8 +93,3 @@ variables that are passed into the expression: Because of this, using the ``condition`` key causes no extra overhead beyond the time it takes for the underlying PHP to execute. - -Injecting parameters ---------------------- - - You can inject container parameters (e.g. ``%kernel.environment%``) into condition, such as ``@Route(condition="'%kernel.environment%' in ['dev']")`` or any other you want.