|
@@ -7,6 +7,8 @@ use ApiPlatform\Core\Annotation\ApiResource;
|
|
|
use ApiPlatform\Core\Annotation\ApiSubresource;
|
|
use ApiPlatform\Core\Annotation\ApiSubresource;
|
|
|
use App\Entity\Billing\AccessIntangible;
|
|
use App\Entity\Billing\AccessIntangible;
|
|
|
use App\Entity\Billing\AccessPayer;
|
|
use App\Entity\Billing\AccessPayer;
|
|
|
|
|
+use App\Entity\Core\Notification;
|
|
|
|
|
+use App\Entity\Core\NotificationUser;
|
|
|
use App\Entity\Organization\Organization;
|
|
use App\Entity\Organization\Organization;
|
|
|
use App\Entity\Organization\OrganizationLicence;
|
|
use App\Entity\Organization\OrganizationLicence;
|
|
|
use App\Repository\Access\AccessRepository;
|
|
use App\Repository\Access\AccessRepository;
|
|
@@ -91,6 +93,12 @@ class Access implements UserInterface
|
|
|
#[ORM\OneToMany(mappedBy: 'access', targetEntity: PersonalizedList::class, cascade: ['persist'], orphanRemoval: true)]
|
|
#[ORM\OneToMany(mappedBy: 'access', targetEntity: PersonalizedList::class, cascade: ['persist'], orphanRemoval: true)]
|
|
|
private Collection $personalizedLists;
|
|
private Collection $personalizedLists;
|
|
|
|
|
|
|
|
|
|
+ #[ORM\OneToMany(mappedBy: 'recipientAccess', targetEntity: Notification::class, orphanRemoval: true)]
|
|
|
|
|
+ private Collection $notifications;
|
|
|
|
|
+
|
|
|
|
|
+ #[ORM\OneToMany(mappedBy: 'access', targetEntity: NotificationUser::class, orphanRemoval: true)]
|
|
|
|
|
+ private Collection $notificationUsers;
|
|
|
|
|
+
|
|
|
#[ORM\ManyToMany(targetEntity: Access::class, mappedBy: 'children', cascade: ['persist'])]
|
|
#[ORM\ManyToMany(targetEntity: Access::class, mappedBy: 'children', cascade: ['persist'])]
|
|
|
private Collection $guardians;
|
|
private Collection $guardians;
|
|
|
|
|
|
|
@@ -120,6 +128,8 @@ class Access implements UserInterface
|
|
|
$this->billingPayers = new ArrayCollection();
|
|
$this->billingPayers = new ArrayCollection();
|
|
|
$this->billingReceivers = new ArrayCollection();
|
|
$this->billingReceivers = new ArrayCollection();
|
|
|
$this->accessIntangibles = new ArrayCollection();
|
|
$this->accessIntangibles = new ArrayCollection();
|
|
|
|
|
+ $this->notifications = new ArrayCollection();
|
|
|
|
|
+ $this->notificationUsers = new ArrayCollection();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public function getId(): ?int
|
|
public function getId(): ?int
|
|
@@ -434,6 +444,60 @@ class Access implements UserInterface
|
|
|
return $this;
|
|
return $this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ public function getNotifications(): Collection
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->notifications;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function addNotification(Notification $notification): self
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!$this->notifications->contains($notification)) {
|
|
|
|
|
+ $this->notifications[] = $notification;
|
|
|
|
|
+ $notification->setRecipientAccess($this);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function removeNotification(Notification $notification): self
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->notifications->removeElement($notification)) {
|
|
|
|
|
+ // set the owning side to null (unless already changed)
|
|
|
|
|
+ if ($notification->getRecipientAccess() === $this) {
|
|
|
|
|
+ $notification->setRecipientAccess(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function getNotificationUsers(): Collection
|
|
|
|
|
+ {
|
|
|
|
|
+ return $this->notificationUsers;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function addNotificationUser(NotificationUser $notificationUser): self
|
|
|
|
|
+ {
|
|
|
|
|
+ if (!$this->notificationUsers->contains($notificationUser)) {
|
|
|
|
|
+ $this->notificationUsers[] = $notificationUser;
|
|
|
|
|
+ $notificationUser->setAccess($this);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function removeNotificationUser(NotificationUser $notificationUser): self
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($this->notificationUsers->removeElement($notificationUser)) {
|
|
|
|
|
+ // set the owning side to null (unless already changed)
|
|
|
|
|
+ if ($notificationUser->getAccess() === $this) {
|
|
|
|
|
+ $notificationUser->setAccess(null);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return $this;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
#[Pure] public function getUserIdentifier(): string
|
|
#[Pure] public function getUserIdentifier(): string
|
|
|
{
|
|
{
|
|
|
return $this->person->getUsername();
|
|
return $this->person->getUsername();
|