mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-04-07 05:23:45 +00:00
Resolve "Notification aux groupes utilisateurs"
This commit is contained in:
@@ -11,20 +11,45 @@ declare(strict_types=1);
|
||||
|
||||
namespace Chill\MainBundle\Notification\Email\NotificationEmailMessages;
|
||||
|
||||
use Chill\MainBundle\Entity\Notification;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
use Chill\MainBundle\Entity\UserGroup;
|
||||
|
||||
readonly class SendImmediateNotificationEmailMessage
|
||||
{
|
||||
private int $notificationId;
|
||||
|
||||
private ?int $userId;
|
||||
|
||||
private ?int $userGroupId;
|
||||
|
||||
public function __construct(
|
||||
private int $notificationId,
|
||||
private int $addresseeId,
|
||||
) {}
|
||||
Notification $notification,
|
||||
UserGroup|User $addressee,
|
||||
) {
|
||||
$this->notificationId = $notification->getId();
|
||||
|
||||
if ($addressee instanceof User) {
|
||||
$this->userId = $addressee->getId();
|
||||
$this->userGroupId = null;
|
||||
} else {
|
||||
$this->userGroupId = $addressee->getId();
|
||||
$this->userId = null;
|
||||
}
|
||||
}
|
||||
|
||||
public function getNotificationId(): int
|
||||
{
|
||||
return $this->notificationId;
|
||||
}
|
||||
|
||||
public function getAddresseeId(): int
|
||||
public function getUserId(): ?int
|
||||
{
|
||||
return $this->addresseeId;
|
||||
return $this->userId;
|
||||
}
|
||||
|
||||
public function getUserGroupId(): ?int
|
||||
{
|
||||
return $this->userGroupId;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user