Skip to content

Commit b337619

Browse files
committed
Merge branch '6.0' into 6.1
* 6.0: Fix documentation symfony notifier
2 parents b908496 + f1db616 commit b337619

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
@@ -657,7 +657,7 @@ and its ``asChatMessage()`` method::
657657
use Symfony\Component\Notifier\Message\ChatMessage;
658658
use Symfony\Component\Notifier\Notification\ChatNotificationInterface;
659659
use Symfony\Component\Notifier\Notification\Notification;
660-
use Symfony\Component\Notifier\Recipient\SmsRecipientInterface;
660+
use Symfony\Component\Notifier\Recipient\RecipientInterface;
661661

662662
class InvoiceNotification extends Notification implements ChatNotificationInterface
663663
{
@@ -670,10 +670,11 @@ and its ``asChatMessage()`` method::
670670

671671
public function asChatMessage(RecipientInterface $recipient, string $transport = null): ?ChatMessage
672672
{
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
674674
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);
677678
}
678679

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

0 commit comments

Comments
 (0)