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 @@ -697,7 +697,7 @@ and its ``asChatMessage()`` method::
697
697
use Symfony\Component\Notifier\Message\ChatMessage;
698
698
use Symfony\Component\Notifier\Notification\ChatNotificationInterface;
699
699
use Symfony\Component\Notifier\Notification\Notification;
700
- use Symfony\Component\Notifier\Recipient\SmsRecipientInterface ;
700
+ use Symfony\Component\Notifier\Recipient\RecipientInterface ;
701
701
702
702
class InvoiceNotification extends Notification implements ChatNotificationInterface
703
703
{
@@ -710,10 +710,11 @@ and its ``asChatMessage()`` method::
710
710
711
711
public function asChatMessage(RecipientInterface $recipient, string $transport = null): ?ChatMessage
712
712
{
713
- // Add a custom emoji if the message is sent to Slack
713
+ // Add a custom subject and emoji if the message is sent to Slack
714
714
if ('slack' === $transport) {
715
- return (new ChatMessage('You\'re invoiced '.$this->price.' EUR.'))
716
- ->emoji('money');
715
+ $this->subject('You\'re invoiced '.strval($this->price).' EUR.');
716
+ $this->emoji("money");
717
+ return ChatMessage::fromNotification($this);
717
718
}
718
719
719
720
// If you return null, the Notifier will create the ChatMessage
You can’t perform that action at this time.
0 commit comments