Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd3f803

Browse filesBrowse files
committed
[Messenger] Document the validation middleware
1 parent 66ad276 commit dd3f803
Copy full SHA for dd3f803

File tree

Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-0
lines changed

‎messenger.rst

Copy file name to clipboardExpand all lines: messenger.rst
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,6 +2256,7 @@ when building absolute URLs.
22562256
command_bus:
22572257
middleware:
22582258
- router_context
2259+
- validation
22592260
22602261
.. code-block:: xml
22612262
@@ -2273,6 +2274,7 @@ when building absolute URLs.
22732274
<framework:messenger>
22742275
<framework:bus name="command_bus">
22752276
<framework:middleware id="router_context"/>
2277+
<framework:middleware id="validation"/>
22762278
</framework:bus>
22772279
</framework:messenger>
22782280
</framework:config>
@@ -2288,9 +2290,15 @@ when building absolute URLs.
22882290
22892291
$bus = $messenger->bus('command_bus');
22902292
$bus->middleware()->id('router_context');
2293+
$bus->middleware()->id('validation');
22912294
};
22922295
22932296
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+
22942302
Messenger Events
22952303
~~~~~~~~~~~~~~~~
22962304

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.