Skip to content

Commit 97ce202

Browse files
committed
Merge branch '4.4'
* 4.4: fixup tweak #13099 Update service_subscribers_locators.rst
2 parents 0045470 + 2a66473 commit 97ce202

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

service_container/service_subscribers_locators.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ attribute to the locator service defining the name of this custom method:
515515
# ...
516516
517517
App\HandlerCollection:
518-
arguments: [!tagged_locator { tag: 'app.handler', default_index_method: 'myOwnMethodName' }]
518+
arguments: [!tagged_locator { tag: 'app.handler', index_by: 'key', default_index_method: 'myOwnMethodName' }]
519519
520520
.. code-block:: xml
521521
@@ -531,7 +531,7 @@ attribute to the locator service defining the name of this custom method:
531531
<!-- ... -->
532532
533533
<service id="App\HandlerCollection">
534-
<argument type="tagged_locator" tag="app.handler" default-index-method="myOwnMethodName"/>
534+
<argument type="tagged_locator" tag="app.handler" index-by="key" default-index-method="myOwnMethodName"/>
535535
</service>
536536
</services>
537537
</container>
@@ -544,10 +544,16 @@ attribute to the locator service defining the name of this custom method:
544544
return function(ContainerConfigurator $configurator) {
545545
$configurator->services()
546546
->set(App\HandlerCollection::class)
547-
->args([tagged_locator('app.handler', null, 'myOwnMethodName')])
547+
->args([tagged_locator('app.handler', 'key', 'myOwnMethodName')])
548548
;
549549
};
550550
551+
.. note::
552+
553+
Since code should not be responsible for defining how the locators are
554+
going to be used, a configuration key (``key`` in the example above) must
555+
be set so the custom method may be called as a fallback.
556+
551557
Service Subscriber Trait
552558
------------------------
553559

0 commit comments

Comments
 (0)