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::
804
804
805
805
.. tip ::
806
806
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
809
809
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
810
822
811
823
// src/Handler/One.php
812
824
namespace App\Handler;
813
825
814
826
class One
815
827
{
816
828
// ...
817
- public static function getDefaultIndexName (): string
829
+ public static function getDefaultHandlerName (): string
818
830
{
819
831
return 'handler_one';
820
832
}
You can’t perform that action at this time.
0 commit comments