forked from Codeception/symfony-module-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNotifier.php
More file actions
29 lines (21 loc) · 738 Bytes
/
Notifier.php
File metadata and controls
29 lines (21 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
declare(strict_types=1);
namespace App\Utils;
use App\Entity\User;
use Symfony\Component\Notifier\Notification\Notification;
use Symfony\Component\Notifier\NotifierInterface;
use Symfony\Component\Notifier\Recipient\Recipient;
final readonly class Notifier
{
public function __construct(private NotifierInterface $notifier)
{
}
public function sendConfirmationNotification(User $user): Notification
{
$notification = (new Notification('Account created!', ['chat']))
->content("Account for {$user->getEmail()} created successfully");
$recipient = new Recipient($user->getEmail());
$this->notifier->send($notification, $recipient);
return $notification;
}
}