File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -658,7 +658,7 @@ and its ``asChatMessage()`` method::
658
658
use Symfony\Component\Notifier\Message\ChatMessage;
659
659
use Symfony\Component\Notifier\Notification\ChatNotificationInterface;
660
660
use Symfony\Component\Notifier\Notification\Notification;
661
- use Symfony\Component\Notifier\Recipient\SmsRecipientInterface ;
661
+ use Symfony\Component\Notifier\Recipient\RecipientInterface ;
662
662
663
663
class InvoiceNotification extends Notification implements ChatNotificationInterface
664
664
{
@@ -671,10 +671,11 @@ and its ``asChatMessage()`` method::
671
671
672
672
public function asChatMessage(RecipientInterface $recipient, string $transport = null): ?ChatMessage
673
673
{
674
- // Add a custom emoji if the message is sent to Slack
674
+ // Add a custom subject and emoji if the message is sent to Slack
675
675
if ('slack' === $transport) {
676
- return (new ChatMessage('You\'re invoiced '.$this->price.' EUR.'))
677
- ->emoji('money');
676
+ $this->subject('You\'re invoiced '.strval($this->price).' EUR.');
677
+ $this->emoji("money");
678
+ return ChatMessage::fromNotification($this);
678
679
}
679
680
680
681
// If you return null, the Notifier will create the ChatMessage
You can’t perform that action at this time.
0 commit comments