8000 [Messenger] AsMessageHandler can be used on class methods by mjpvandenberg · Pull Request #16774 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

[Messenger] AsMessageHandler can be used on class methods #16774

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ message class (or a message interface)::
using PHP 7.4), by implementing :class:`Symfony\\Component\\Messenger\\Handler\\MessageHandlerInterface`
instead.

.. note::

As of Symfony 6.1, the ``AsMessageHandler`` attribute can be used on individual
class methods as well. You may use the attribute on as many methods in a single
class as you like, allowing you to group the handling of multiple related types
of messages.

Thanks to :ref:`autoconfiguration <services-autoconfigure>` and the ``SmsNotification``
type-hint, Symfony knows that this handler should be called when an ``SmsNotification``
message is dispatched. Most of the time, this is all you need to do. But you can
Expand Down
0