Skip to content

Commit 2b5f165

Browse files
committed
[DependencyInjection] Add documentation for service locator changes
1 parent d4310d9 commit 2b5f165

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

service_container/service_subscribers_locators.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,9 @@ Defining a Service Locator
246246
--------------------------
247247

248248
To manually define a service locator, create a new service definition and add
249-
the ``container.service_locator`` tag to it. Use its ``arguments`` option to
250-
include as many services as needed in it.
249+
the ``container.service_locator`` tag to it. Use the first argument of the
250+
service definition to pass a collection of services to the service locator. If
251+
there is no id specified for the service it will inherit its external id.
251252

252253
.. configuration-block::
253254

@@ -314,6 +315,10 @@ include as many services as needed in it.
314315
previous Symfony versions you always needed to add the
315316
``container.service_locator`` tag explicitly.
316317

318+
.. versionadded:: 4.2
319+
The ability to add services without specifying an id was introduced in
320+
Symfony 4.2.
321+
317322
.. note::
318323

319324
The services defined in the service locator argument must include keys,

0 commit comments

Comments
 (0)