@@ -53,7 +53,7 @@ sure ``dispatch_after_current_bus`` is registered before ``doctrine_transaction`
53
53
in the middleware chain.
54
54
55
55
**Note: ** The ``dispatch_after_current_bus `` middleware must be loaded for *all * of the
56
- buses. For the example, the middleware must be loaded for both the command and event buses .
56
+ buses. For the example, the middleware must be loaded for both the command and event bus .
57
57
58
58
.. configuration-block ::
59
59
@@ -75,6 +75,47 @@ buses. For the example, the middleware must be loaded for both the command and e
75
75
- validation
76
76
- doctrine_transaction
77
77
78
+ .. code-block :: xml
79
+
80
+ <!-- config/packages/cache.xml -->
81
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
82
+ <container xmlns =" http://symfony.com/schema/dic/services"
83
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
84
+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
85
+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
86
+ https://symfony.com/schema/dic/services/services-1.0.xsd" >
87
+
88
+ <framework : config >
89
+ <framework : messenger default_bus =" messenger.bus.command" >
90
+ <framework : bus name =" messenger.bus.command" >
91
+ <framework : middleware id =" validation" >
92
+ <framework : middleware id =" doctrine_transaction" >
93
+ </framework : bus >
94
+ <framework : bus name =" messenger.bus.command" default_middleware =" allow_no_handlers" >
95
+ <framework : middleware id =" validation" >
96
+ <framework : middleware id =" doctrine_transaction" >
97
+ </framework : bus >
98
+ </framework : messenger >
99
+ </framework : config >
100
+ </container >
101
+
102
+ .. code-block :: php
103
+
104
+ // config/packages/cache.php
105
+ $container->loadFromExtension('framework', [
106
+ 'messenger' => [
107
+ 'default_bus' => 'messenger.bus.command',
108
+ 'buses' => [
109
+ 'messenger.bus.command' => [
110
+ 'middleware' => ['validation', 'doctrine_transaction'],
111
+ ],
112
+ 'messenger.bus.event' => [
113
+ 'default_middleware' => 'allow_no_handlers',
114
+ 'middleware' => ['validation', 'doctrine_transaction'],
115
+ ],
116
+ ],
117
+ ],
118
+ ]);
78
119
79
120
.. code-block :: php
80
121
0 commit comments