8000 minor #16774 [Messenger] AsMessageHandler can be used on class method… · symfony/symfony-docs@a44000e · GitHub
[go: up one dir, main page]

Skip to content

Commit a44000e

Browse files
committed
minor #16774 [Messenger] AsMessageHandler can be used on class methods (mjpvandenberg)
This PR was merged into the 6.1 branch. Discussion ---------- [Messenger] AsMessageHandler can be used on class methods Documents symfony/symfony#45273 Commits ------- 2bf52dd AsMessageHandler can be used on class methods
2 parents fd334dd + 2bf52dd commit a44000e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

messenger.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ message class (or a message interface)::
7676
using PHP 7.4), by implementing :class:`Symfony\\Component\\Messenger\\Handler\\MessageHandlerInterface`
7777
instead.
7878

79+
.. note::
80+
81+
As of Symfony 6.1, the ``AsMessageHandler`` attribute can be used on individual
82+
class methods as well. You may use the attribute on as many methods in a single
83+
class as you like, allowing you to group the handling of multiple related types
84+
of messages.
85+
7986
Thanks to :ref:`autoconfiguration <services-autoconfigure>` and the ``SmsNotification``
8087
type-hint, Symfony knows that this handler should be called when an ``SmsNotification``
8188
message is dispatched. Most of the time, this is all you need to do. But you can

0 commit comments

Comments
 (0)
0