Skip to content

Commit f1db616

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: Fix documentation symfony notifier
2 parents 7652e0e + dfa57c5 commit f1db616

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
@@ -643,7 +643,7 @@ and its ``asChatMessage()`` method::
643643
use Symfony\Component\Notifier\Message\ChatMessage;
644644
use Symfony\Component\Notifier\Notification\ChatNotificationInterface;
645645
use Symfony\Component\Notifier\Notification\Notification;
646-
use Symfony\Component\Notifier\Recipient\SmsRecipientInterface;
646+
use Symfony\Component\Notifier\Recipient\RecipientInterface;
647647

648648
class InvoiceNotification extends Notification implements ChatNotificationInterface
649649
{
@@ -656,10 +656,11 @@ and its ``asChatMessage()`` method::
656656

657657
public function asChatMessage(RecipientInterface $recipient, string $transport = null): ?ChatMessage
658658
{
659-
// Add a custom emoji if the message is sent to Slack
659+
// Add a custom subject and emoji if the message is sent to Slack
660660
if ('slack' === $transport) {
661-
return (new ChatMessage('You\'re invoiced '.$this->price.' EUR.'))
662-
->emoji('money');
661+
$this->subject('You\'re invoiced '.strval($this->price).' EUR.');
662+
$this->emoji("money");
663+
return ChatMessage::fromNotification($this);
663664
}
664665

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

0 commit comments

Comments
 (0)