asPushMessage example

use Symfony\Component\Notifier\Recipient\RecipientInterface;

/** * @author Tomas Norkūnas <norkunas.tom@gmail.com> */
class PushChannel extends AbstractChannel
{
    public function notify(Notification $notification, RecipientInterface $recipient, string $transportName = null): void
    {
        $message = null;
        if ($notification instanceof PushNotificationInterface) {
            $message = $notification->asPushMessage($recipient$transportName);
        }

        $message ??= PushMessage::fromNotification($notification);

        if (null !== $transportName) {
            $message->transport($transportName);
        }

        if (null === $this->bus) {
            $this->transport->send($message);
        } else {
            
Home | Imprint | This part of the site doesn't use cookies.