@@ -53,7 +53,7 @@ sure ``dispatch_after_current_bus`` is registered before ``doctrine_transaction`
5353in the middleware chain.
5454
5555**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 eventbuses .
56+ buses. For the example, the middleware must be loaded for both the command and eventbus .
5757
5858..configuration-block ::
5959
@@ -75,6 +75,47 @@ buses. For the example, the middleware must be loaded for both the command and e
7575 -validation
7676 -doctrine_transaction
7777
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+ ]);
78119
79120 ..code-block ::php
80121