kbin-core/src/Service/Notification/MagazineBanNotificationManager.php
2021-04-21 22:27:31 +02:00

28 lines
669 B
PHP

<?php declare(strict_types=1);
namespace App\Service\Notification;
use App\Entity\MagazineBan;
use App\Entity\MagazineBanNotification;
use App\Repository\MagazineBanRepository;
use Doctrine\ORM\EntityManagerInterface;
class MagazineBanNotificationManager
{
use NotificationTrait;
public function __construct(
private MagazineBanRepository $repository,
private EntityManagerInterface $entityManager
) {
}
public function send(MagazineBan $ban): void
{
$notification = new MagazineBanNotification($ban->user, $ban);
$this->entityManager->persist($notification);
$this->entityManager->flush();
}
}