Skip to content

Commit 8ab22b1

Browse files
committed
Merge branch '4.4' into 5.0
* 4.4: [Mailer] Minor tweaks in the mailer docs [Messenger] Minor tweaks for the main Messenger article [Messenger] Added a missing class import
2 parents 5da0ab4 + 4d42897 commit 8ab22b1

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

components/messenger.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ Instead of dealing directly with the messages in the middleware you receive the
157157
Hence you can inspect the envelope content and its stamps, or add any::
158158

159159
use App\Message\Stamp\AnotherStamp;
160+
use Symfony\Component\Messenger\Envelope;
160161
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
161162
use Symfony\Component\Messenger\Middleware\StackInterface;
162163
use Symfony\Component\Messenger\Stamp\ReceivedStamp;

mailer.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,9 @@ and create an :class:`Symfony\\Component\\Mime\\Email` object::
117117
->text('Sending emails is fun again!')
118118
->html('<p>See Twig integration for better HTML integration!</p>');
119119

120-
$mailer->send($email);
120+
/** @var Symfony\Component\Mailer\SentMessage $sentEmail */
121+
$sentEmail = $mailer->send($email);
122+
// $messageId = $sentEmail->getMessageId();
121123

122124
// ...
123125
}
@@ -156,7 +158,8 @@ both strings or address objects::
156158

157159
Instead of calling ``->from()`` *every* time you create a new email, you can
158160
create an :doc:`event subscriber </event_dispatcher>` and listen to the
159-
``MessageEvent::class`` event to set the same ``From`` email to all messages.
161+
:class:`Symfony\\Component\\Mailer\\Event\\MessageEvent` event to set the
162+
same ``From`` email to all messages.
160163

161164
Multiple addresses are defined with the ``addXXX()`` methods::
162165

messenger.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ serialized::
5050

5151
.. _messenger-handler:
5252

53-
A message handler is a PHP callable, the recommended way to create it is to create a class that
54-
implements ``MessageHandlerInterface`` and has an ``__invoke()`` method that's
55-
type-hinted with the message class (or a message interface)::
53+
A message handler is a PHP callable, the recommended way to create it is to
54+
create a class that implements :class:`Symfony\\Component\\Messenger\\Handler\\MessageHandlerInterface`
55+
and has an ``__invoke()`` method that's type-hinted with the message class (or a
56+
message interface)::
5657

5758
// src/MessageHandler/SmsNotificationHandler.php
5859
namespace App\MessageHandler;
@@ -111,7 +112,7 @@ Transports: Async/Queued Messages
111112
By default, messages are handled as soon as they are dispatched. If you want
112113
to handle a message asynchronously, you can configure a transport. A transport
113114
is capable of sending messages (e.g. to a queueing system) and then
114-
:ref:`receiving them via a worker<messenger-worker>`. Messenger supports
115+
:ref:`receiving them via a worker <messenger-worker>`. Messenger supports
115116
:ref:`multiple transports <messenger-transports-config>`.
116117

117118
.. note::
@@ -498,7 +499,7 @@ different messages to them. For example:
498499
# queue_name is specific to the doctrine transport
499500
queue_name: high
500501
501-
# for amqp send to a separate exchange then queue
502+
# for AMQP send to a separate exchange then queue
502503
#exchange:
503504
# name: high
504505
#queues:
@@ -1229,7 +1230,7 @@ Envelopes & Stamps
12291230
~~~~~~~~~~~~~~~~~~
12301231

12311232
A message can be any PHP object. Sometimes, you may need to configure something
1232-
extra about the message - like the way it should be handled inside Amqp or adding
1233+
extra about the message - like the way it should be handled inside AMQP or adding
12331234
a delay before the message should be handled. You can do that by adding a "stamp"
12341235
to your message::
12351236

@@ -1283,8 +1284,8 @@ for each bus looks like this:
12831284

12841285
.. note::
12851286

1286-
These middleware names are actually shortcuts names. The real service ids
1287-
are prefixed with ``messenger.middleware.``.
1287+
These middleware names are actually shortcut names. The real service ids
1288+
are prefixed with ``messenger.middleware.`` (e.g. ``messenger.middleware.handle_message``).
12881289

12891290
The middleware are executed when the message is dispatched but *also* again when
12901291
a message is received via the worker (for messages that were sent to a transport

0 commit comments

Comments
 (0)