File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -804,17 +804,29 @@ array element. For example, to retrieve the ``handler_two`` handler::
804804
805805.. tip ::
806806
807- Just like the priority, you can also implement a static
808- ``getDefaultIndexName () `` method in the handlers and omit the
807+ Just like the priority, if you set the attribute (`` index_by ``) on the :tagged_iterator, you can also implement a static
808+ ``getDefault(``index_by ``)Name ()`` method in the handlers and omit the
809809 index attribute (``key ``)::
810+
811+
812+ .. code-block:: yaml
813+
814+ # config/services.yaml
815+ services:
816+ # ...
817+
818+ App\HandlerCollection:
819+ arguments: [!tagged_iterator { tag: 'app.handler', index_by: 'handler' }]
820+
821+ .. code-block :: php
810822
811823 // src/Handler/One.php
812824 namespace App\Handler;
813825
814826 class One
815827 {
816828 // ...
817- public static function getDefaultIndexName (): string
829+ public static function getDefaultHandlerName (): string
818830 {
819831 return 'handler_one';
820832 }
You can’t perform that action at this time.
0 commit comments