mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
send first calendar on ms graph
This commit is contained in:
@@ -12,6 +12,7 @@ declare(strict_types=1);
|
||||
namespace Chill\CalendarBundle\Messenger\Message;
|
||||
|
||||
use Chill\CalendarBundle\Entity\Calendar;
|
||||
use Chill\CalendarBundle\Entity\Invite;
|
||||
use Chill\MainBundle\Entity\User;
|
||||
|
||||
class CalendarMessage
|
||||
@@ -26,11 +27,38 @@ class CalendarMessage
|
||||
|
||||
private int $calendarId;
|
||||
|
||||
public function __construct(Calendar $calendar, string $action, User $byUser)
|
||||
{
|
||||
private array $newInvitesIds = [];
|
||||
|
||||
/**
|
||||
* @var array<array{inviteId: int, userId: int, userEmail: int, userLabel: string}>
|
||||
*/
|
||||
private array $oldInvites = [];
|
||||
|
||||
private ?int $previousCalendarRangeId = null;
|
||||
|
||||
private ?int $previousMainUserId = null;
|
||||
|
||||
public function __construct(
|
||||
Calendar $calendar,
|
||||
string $action,
|
||||
User $byUser
|
||||
) {
|
||||
$this->calendarId = $calendar->getId();
|
||||
$this->byUserId = $byUser->getId();
|
||||
$this->action = $action;
|
||||
$this->previousCalendarRangeId = null !== $calendar->previousCalendarRange ?
|
||||
$calendar->previousCalendarRange->getId() : null;
|
||||
$this->previousMainUserId = null !== $calendar->previousMainUser ?
|
||||
$calendar->previousMainUser->getId() : null;
|
||||
$this->newInvitesIds = array_map(static fn (Invite $i) => $i->getId(), $calendar->newInvites);
|
||||
$this->oldInvites = array_map(static function (Invite $i) {
|
||||
return [
|
||||
'inviteId' => $i->getId(),
|
||||
'userId' => $i->getUser()->getId(),
|
||||
'userEmail' => $i->getUser()->getEmail(),
|
||||
'userLabel' => $i->getUser()->getLabel(),
|
||||
];
|
||||
}, $calendar->oldInvites);
|
||||
}
|
||||
|
||||
public function getAction(): string
|
||||
@@ -47,4 +75,30 @@ class CalendarMessage
|
||||
{
|
||||
return $this->calendarId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|int[]|null[]
|
||||
*/
|
||||
public function getNewInvitesIds(): array
|
||||
{
|
||||
return $this->newInvitesIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<array{inviteId: int, userId: int, userEmail: int, userLabel: string}>
|
||||
*/
|
||||
public function getOldInvites(): array
|
||||
{
|
||||
return $this->oldInvites;
|
||||
}
|
||||
|
||||
public function getPreviousCalendarRangeId(): ?int
|
||||
{
|
||||
return $this->previousCalendarRangeId;
|
||||
}
|
||||
|
||||
public function getPreviousMainUserId(): ?int
|
||||
{
|
||||
return $this->previousMainUserId;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user