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