@@ -79,14 +79,15 @@ services.
79
79
80
80
**Service Subscribers ** are intended to solve this problem by giving access to a
81
81
set of predefined services while instantiating them only when actually needed
82
- through a service locator .
82
+ through a ** Service Locator **, a separate lazy-loaded container .
83
83
84
84
Defining a Service Subscriber
85
85
-----------------------------
86
86
87
87
First, turn ``CommandBus `` into an implementation of :class: `Symfony\\ Component\\ DependencyInjection\\ ServiceSubscriberInterface `.
88
88
Use its ``getSubscribedServices `` method to include as many services as needed
89
- in the service locater and change the container to a PSR-11 ``ContainerInterface ``::
89
+ in the service subscriber and change the type hint of the container to
90
+ a PSR-11 ``ContainerInterface ``::
90
91
91
92
// src/AppBundle/CommandBus.php
92
93
namespace AppBundle;
@@ -128,7 +129,7 @@ in the service locater and change the container to a PSR-11 ``ContainerInterface
128
129
.. tip ::
129
130
130
131
If the container does *not * contain the subscribed services, double-check
131
- that you have :ref: `autoconfigure <services-autoconfigure >` enabled. You
132
+ that you have :ref: `autoconfigure <services-autoconfigure >` enabled. You
132
133
can also manually add the ``container.service_subscriber `` tag.
133
134
134
135
The injected service is an instance of :class: `Symfony\\ Component\\ DependencyInjection\\ ServiceLocator `
@@ -173,7 +174,7 @@ Optional services
173
174
~~~~~~~~~~~~~~~~~
174
175
175
176
For optional dependencies, prepend the service type with a ``? `` to prevent
176
- errors if there's no matching service in the service container::
177
+ errors if there's no matching service found in the service container::
177
178
178
179
use Psr\Log\LoggerInterface;
179
180
@@ -306,7 +307,7 @@ include as many services as needed in it.
306
307
The services defined in the service locator argument must include keys,
307
308
which later become their unique identifiers inside the locator.
308
309
309
- Now you can use the service locator injecting it in any other service:
310
+ Now you can use the service locator by injecting it in any other service:
310
311
311
312
.. configuration-block ::
312
313
0 commit comments