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