Skip to content

Commit fcfef73

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: Fix documentation symfony notifier
2 parents b6a822b + b337619 commit fcfef73

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

notifier.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ and its ``asChatMessage()`` method::
662662
use Symfony\Component\Notifier\Message\ChatMessage;
663663
use Symfony\Component\Notifier\Notification\ChatNotificationInterface;
664664
use Symfony\Component\Notifier\Notification\Notification;
665-
use Symfony\Component\Notifier\Recipient\SmsRecipientInterface;
665+
use Symfony\Component\Notifier\Recipient\RecipientInterface;
666666

667667
class InvoiceNotification extends Notification implements ChatNotificationInterface
668668
{
@@ -675,10 +675,11 @@ and its ``asChatMessage()`` method::
675675

676676
public function asChatMessage(RecipientInterface $recipient, string $transport = null): ?ChatMessage
677677
{
678-
// Add a custom emoji if the message is sent to Slack
678+
// Add a custom subject and emoji if the message is sent to Slack
679679
if ('slack' === $transport) {
680-
return (new ChatMessage('You\'re invoiced '.$this->price.' EUR.'))
681-
->emoji('money');
680+
$this->subject('You\'re invoiced '.strval($this->price).' EUR.');
681+
$this->emoji("money");
682+
return ChatMessage::fromNotification($this);
682683
}
683684

684685
// If you return null, the Notifier will create the ChatMessage

0 commit comments

Comments
 (0)