Skip to content

Commit

Permalink
removing more scope stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Nov 30, 2015
1 parent 81c7572 commit eff9733
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 16 deletions.
14 changes: 0 additions & 14 deletions book/service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -884,20 +884,6 @@ Now, just inject the ``request_stack``, which behaves like any normal service:
array(new Reference('request_stack'))
));
.. sidebar:: Why not Inject the ``request`` Service?

Almost all Symfony2 built-in services behave in the same way: a single
instance is created by the container which it returns whenever you get it or
when it is injected into another service. There is one exception in a standard
Symfony2 application: the ``request`` service.

If you try to inject the ``request`` into a service, you will probably receive
a
:class:`Symfony\\Component\\DependencyInjection\\Exception\\ScopeWideningInjectionException`
exception. That's because the ``request`` can **change** during the life-time
of a container (when a sub-request is created for instance).


.. tip::

If you define a controller as a service then you can get the ``Request``
Expand Down
3 changes: 1 addition & 2 deletions components/dependency_injection/parentservices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ called when the child services are instantiated.

.. caution::

The ``scope``, ``abstract`` and ``tags`` attributes are always taken
from the child service.
The ``abstract`` and ``tags`` attributes are always taken from the child service.

The parent service is abstract as it should not be directly retrieved from
the container or passed into another service. It exists merely as a "template"
Expand Down

0 comments on commit eff9733

Please sign in to comment.