From 86ef304da56771a9f320ecd030843000ac6e79c9 Mon Sep 17 00:00:00 2001 From: Joel Clermont Date: Sat, 30 Mar 2013 15:02:46 -0400 Subject: [PATCH 1/4] add note on service parameters regarding ScopeWideningInjectionException --- book/service_container.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/book/service_container.rst b/book/service_container.rst index 917eb0264e0..52189055b1c 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -231,6 +231,15 @@ looks up the value of each parameter and uses it in the service definition. http://symfony.com/?foo=%%s&bar=%%d +.. note:: + + It can be useful to pass other services in as arguments to your custom service. + For example, you may want to pass in the `request` service as an argument. + In these cases, you may receive a `ScopeWideningInjectionException`. + To understand this problem better and learn how to solve it, refer to + the cookbook article :doc:`/cookbook/service_container/scopes` for a + few solutions. + The purpose of parameters is to feed information into services. Of course there was nothing wrong with defining the service without using any parameters. Parameters, however, have several advantages: From 5aaad8db5b497a7921d43894023da18a6cf0d32d Mon Sep 17 00:00:00 2001 From: Joel Clermont Date: Sat, 30 Mar 2013 15:13:45 -0400 Subject: [PATCH 2/4] fix backticks with double backticks --- book/service_container.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/service_container.rst b/book/service_container.rst index 52189055b1c..003b053cb40 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -234,8 +234,8 @@ looks up the value of each parameter and uses it in the service definition. .. note:: It can be useful to pass other services in as arguments to your custom service. - For example, you may want to pass in the `request` service as an argument. - In these cases, you may receive a `ScopeWideningInjectionException`. + For example, you may want to pass in the ``request`` service as an argument. + In these cases, you may receive a ``ScopeWideningInjectionException``. To understand this problem better and learn how to solve it, refer to the cookbook article :doc:`/cookbook/service_container/scopes` for a few solutions. From d3cea66b86b19bcc86cc5e9c002dd73fdfa2f394 Mon Sep 17 00:00:00 2001 From: Joel Clermont Date: Sat, 30 Mar 2013 17:21:31 -0400 Subject: [PATCH 3/4] remove unnecessary text --- book/service_container.rst | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/book/service_container.rst b/book/service_container.rst index 003b053cb40..377ddfcfc74 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -237,8 +237,7 @@ looks up the value of each parameter and uses it in the service definition. For example, you may want to pass in the ``request`` service as an argument. In these cases, you may receive a ``ScopeWideningInjectionException``. To understand this problem better and learn how to solve it, refer to - the cookbook article :doc:`/cookbook/service_container/scopes` for a - few solutions. + the cookbook article :doc:`/cookbook/service_container/scopes`. The purpose of parameters is to feed information into services. Of course there was nothing wrong with defining the service without using any parameters. From 7b0bfac533e96ab33269817c63a0db14d6a43191 Mon Sep 17 00:00:00 2001 From: Joel Clermont Date: Tue, 2 Apr 2013 11:19:30 -0400 Subject: [PATCH 4/4] change note to caution and simplify text --- book/service_container.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/book/service_container.rst b/book/service_container.rst index 377ddfcfc74..c2276732665 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -231,13 +231,13 @@ looks up the value of each parameter and uses it in the service definition. http://symfony.com/?foo=%%s&bar=%%d -.. note:: +.. caution:: - It can be useful to pass other services in as arguments to your custom service. - For example, you may want to pass in the ``request`` service as an argument. - In these cases, you may receive a ``ScopeWideningInjectionException``. - To understand this problem better and learn how to solve it, refer to - the cookbook article :doc:`/cookbook/service_container/scopes`. + You may receive a + :class:`Symfony\\Component\\DependencyInjection\\Exception\\ScopeWideningInjectionException` + when passing the ``request`` service as an argument. To understand this + problem better and learn how to solve it, refer to the cookbook article + :doc:`/cookbook/service_container/scopes`. The purpose of parameters is to feed information into services. Of course there was nothing wrong with defining the service without using any parameters.