File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -2256,6 +2256,7 @@ when building absolute URLs.
2256
2256
command_bus :
2257
2257
middleware :
2258
2258
- router_context
2259
+ - validation
2259
2260
2260
2261
.. code-block :: xml
2261
2262
@@ -2273,6 +2274,7 @@ when building absolute URLs.
2273
2274
<framework : messenger >
2274
2275
<framework : bus name =" command_bus" >
2275
2276
<framework : middleware id =" router_context" />
2277
+ <framework : middleware id =" validation" />
2276
2278
</framework : bus >
2277
2279
</framework : messenger >
2278
2280
</framework : config >
@@ -2288,9 +2290,15 @@ when building absolute URLs.
2288
2290
2289
2291
$bus = $messenger->bus('command_bus');
2290
2292
$bus->middleware()->id('router_context');
2293
+ $bus->middleware()->id('validation');
2291
2294
};
2292
2295
2293
2296
2297
+ Add the ``validation `` middleware if you need to validate the message object before handling it.
2298
+ Internally it uses the Symfony's validator. If validation fails, a ``ValidationFailedException ``
2299
+ will be thrown that you can catch and read errors from.
2300
+
2301
+
2294
2302
Messenger Events
2295
2303
~~~~~~~~~~~~~~~~
2296
2304
You can’t perform that action at this time.
0 commit comments