Skip to content

Commit fa19770

Browse files
committed
Fix service locator declaration
1 parent f5e4942 commit fa19770

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

service_container/service_locators.rst

+10-7
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ option to include as many services as needed to it and add the
9191
9292
app.command_handler_locator:
9393
class: Symfony\Component\DependencyInjection\ServiceLocator
94-
arguments:
95-
AppBundle\FooCommand: '@app.command_handler.foo'
96-
AppBundle\BarCommand: '@app.command_handler.bar'
9794
tags: ['container.service_locator']
95+
arguments:
96+
-
97+
AppBundle\FooCommand: '@app.command_handler.foo'
98+
AppBundle\BarCommand: '@app.command_handler.bar'
9899
99100
.. code-block:: xml
100101
@@ -106,8 +107,10 @@ option to include as many services as needed to it and add the
106107
<services>
107108
108109
<service id="app.command_handler_locator" class="Symfony\Component\DependencyInjection\ServiceLocator">
109-
<argument key="AppBundle\FooCommand" type="service" id="app.command_handler.foo" />
110-
<argument key="AppBundle\BarCommand" type="service" id="app.command_handler.bar" />
110+
<argument type="collection">
111+
<argument key="AppBundle\FooCommand" type="service" id="app.command_handler.foo" />
112+
<argument key="AppBundle\BarCommand" type="service" id="app.command_handler.bar" />
113+
</argument>
111114
<tag name="container.service_locator" />
112115
</service>
113116
@@ -124,10 +127,10 @@ option to include as many services as needed to it and add the
124127
$container
125128
->register('app.command_handler_locator', ServiceLocator::class)
126129
->addTag('container.service_locator')
127-
->setArguments(array(
130+
->setArguments(array(array(
128131
'AppBundle\FooCommand' => new Reference('app.command_handler.foo'),
129132
'AppBundle\BarCommand' => new Reference('app.command_handler.bar'),
130-
))
133+
)))
131134
;
132135
133136
.. note::

0 commit comments

Comments
 (0)