fix the mail notifier

This commit is contained in:
Simon Vieille 2022-05-07 16:24:04 +02:00
parent f77c4691b9
commit 1b6b3ab0c6
Signed by: deblan
GPG Key ID: 579388D585F70417
1 changed files with 7 additions and 6 deletions

View File

@ -5,6 +5,7 @@ namespace App\Core\Notification;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\Mailer\MailerInterface;
use Twig\Environment as TwigEnvironment;
use App\Entity\User;
/**
* class MailNotifier.
@ -139,19 +140,19 @@ class MailNotifier
return $this;
}
public function addRecipientByAccount(Account $account, bool $isBcc = false): self
public function addRecipientByUser(User $user, bool $isBcc = false): self
{
return $this->addRecipient($account->getEmail(), $isBcc);
return $this->addRecipient($user->getEmail(), $isBcc);
}
public function addRecipientsByAccounts($accounts, bool $isBcc = false)
public function addRecipientsByUsers($users, bool $isBcc = false)
{
if (!is_array($accounts)) {
if (!is_array($users)) {
throw new InvalidArgumentException('The "accounts" parameter must be an array or an instance of ObjectCollection');
}
foreach ($accounts as $account) {
$this->addRecipientByAccount($account, $isBcc);
foreach ($users as $user) {
$this->addRecipientByUser($user, $isBcc);
}
return $this;