File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -923,6 +923,31 @@ them will not cause the container to be rebuilt.
923
923
means that all classes are "available to be *used * as services" without needing
924
924
to be manually configured.
925
925
926
+ .. sidebar :: The ``namespace`` Option
927
+
928
+ .. versionadded :: 3.4
929
+ The ``namespace `` option was added in Symfony 3.4.
930
+
931
+ When using the ``resource `` option in YAML, the namespace prefix can only be used once
932
+ per file when defining it as the ``id ``. In order to have multiple definitions in the
933
+ same file with the same namespace prefix, you can use the ``namespace `` option. When
934
+ this option is used, the ``id `` can be anything as long as it is unique. For example,
935
+ you can define your services like this:
936
+
937
+ .. code-block :: yaml
938
+
939
+ # app/config/services.yml
940
+ services :
941
+ command_handlers :
942
+ namespace : App\Domain\
943
+ resource : ../../src/Domain/*/CommandHandler
944
+ tags : [command_handler]
945
+
946
+ event_subscribers :
947
+ namespace : App\Domain\
948
+ resource : ../../src/Domain/*/EventSubscriber
949
+ tags : [event_subscriber]
950
+
926
951
.. _services-explicitly-configure-wire-services :
927
952
928
953
Explicitly Configuring Services and Arguments
You can’t perform that action at this time.
0 commit comments