Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc5ef85

Browse files
codedmonkeyjaviereguiluz
authored andcommitted
[DependencyInjection] Add documentation for service locator changes
1 parent 61f4ecc commit bc5ef85

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

service_container/service_subscribers_locators.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,9 @@ Defining a Service Locator
243243
--------------------------
244244

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

249250
.. configuration-block::
250251

@@ -306,6 +307,16 @@ include as many services as needed in it.
306307
// ->addTag('container.service_locator')
307308
;
308309
310+
.. versionadded:: 4.1
311+
The service locator autoconfiguration was introduced in Symfony 4.1. In
312+
previous Symfony versions you always needed to add the
313+
``container.service_locator`` tag explicitly.
314+
315+
.. versionadded:: 4.2
316+
317+
The ability to add services without specifying an id was introduced in
318+
Symfony 4.2.
319+
309320
.. note::
310321

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

0 commit comments

Comments
 (0)