Skip to content

Commit 0015c9d

Browse files
committed
[symfony#2729] Tweaks to the new synthetic service documentation by @wouterj
1 parent d6dfc08 commit 0015c9d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

components/dependency_injection/advanced.rst

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ Synthetic Services
6565
Synthetic services are services that are injected into the container instead
6666
of being created by the container.
6767

68-
For instance, the ``request`` service which is injected in the
69-
:method:`HttpKernel::handle() <Symfony\\Component\\HttpKernel\\HttpKernel::handle>`
68+
For example, if you're using the :doc:`HttpKernel</components/http_kernel/introduction>`
69+
component with the DependencyInjection component, then the the ``request``
70+
service is injected in the
71+
:method:`ContainerAwareHttpKernel::handle() <Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel::handle>`
7072
method when entering the request :doc:`scope </cookbook/service_container/scopes>`.
7173
The class does not exist when there is no request, so it can't be included in
7274
the container configuration. Also, the service should be different for every
@@ -96,11 +98,11 @@ To create a synthetic service, set ``synthetic`` to ``true``:
9698
->setSynthetic(true);
9799
98100
As you see, only the ``synthetic`` option is set. All other options are only used
99-
to configure the container how a service is created by the container. As the
100-
service isn't created by the container, these options are omitted.
101+
to configure how a service is created by the container. As the service isn't
102+
created by the container, these options are omitted.
101103

102104
Now, you can inject the class by using
103-
:method:`Symfony\\Component\\DependencyInjection\\ContainerBuilder::set`::
105+
:method:`Container::set<Symfony\\Component\\DependencyInjection\\Container::set>`::
104106

105107
// ...
106108
$container->set('request', new MyRequest(...));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy