false])] private bool $adminAccess = false; #[ORM\Column(options: ['default' => false])] #[Groups(['private'])] private bool $superAdminAccess = false; #[ORM\Column(nullable: true)] #[Groups(['my_access:input'])] private ?int $activityYear = null; #[ORM\ManyToOne(cascade: ['persist'])] #[ORM\JoinColumn(nullable: false)] #[Groups(["access_people_ref", "access_address"])] private Person $person; #[ORM\ManyToOne] #[ORM\JoinColumn(nullable: false)] private Organization $organization; #[ORM\Column(type: 'json', length: 4294967295, nullable: true)] private ?array $roles = []; #[Groups(['my_access:input'])] #[ORM\Column(type: 'json', length: 4294967295, nullable: true)] private ?array $setting = []; #[Groups(['my_access:input'])] private array $historical = []; #[ORM\OneToMany(mappedBy: 'access', targetEntity: PersonActivity::class, cascade: ['persist'], orphanRemoval: true)] #[ApiSubresource] private Collection $personActivity; #[ORM\OneToMany(mappedBy: 'access', targetEntity: OrganizationFunction::class, cascade: ['persist'], orphanRemoval: true)] #[ApiSubresource] private Collection $organizationFunction; #[ORM\OneToMany(mappedBy: 'licensee', targetEntity: OrganizationLicence::class, cascade: ['persist'], orphanRemoval: true)] private Collection $organizationLicences; #[ORM\OneToMany(mappedBy: 'access', targetEntity: PersonalizedList::class, cascade: ['persist'], orphanRemoval: true)] 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'])] private Collection $guardians; #[ORM\ManyToMany(targetEntity: Access::class, inversedBy: 'guardians', cascade: ['persist'])] #[ORM\JoinTable(name: 'children_guardians')] #[ORM\JoinColumn(name: 'guardians_id', referencedColumnName: 'id')] #[ORM\InverseJoinColumn(name: 'children_id', referencedColumnName: 'id')] private Collection $children; #[ORM\OneToMany(mappedBy: 'accessPayer', targetEntity: AccessPayer::class, cascade: ['persist'], orphanRemoval: true)] private Collection $billingPayers; #[ORM\OneToMany(mappedBy: 'accessReceiver', targetEntity: AccessPayer::class, cascade: ['persist'], orphanRemoval: true)] private Collection $billingReceivers; #[ORM\OneToMany(mappedBy: 'access', targetEntity: AccessIntangible::class, cascade: ['persist'], orphanRemoval: true)] private Collection $accessIntangibles; #[Pure] public function __construct() { $this->personActivity = new ArrayCollection(); $this->organizationFunction = new ArrayCollection(); $this->organizationLicences = new ArrayCollection(); $this->personalizedLists = new ArrayCollection(); $this->guardians = new ArrayCollection(); $this->children = new ArrayCollection(); $this->billingPayers = new ArrayCollection(); $this->billingReceivers = new ArrayCollection(); $this->accessIntangibles = new ArrayCollection(); $this->notifications = new ArrayCollection(); $this->notificationUsers = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getAdminAccess(): ?bool { return $this->adminAccess; } public function setAdminAccess(bool $adminAccess): self { $this->adminAccess = $adminAccess; return $this; } public function getSuperAdminAccess(): ?bool { return $this->superAdminAccess; } public function setSuperAdminAccess(bool $superAdminAccess): self { $this->superAdminAccess = $superAdminAccess; return $this; } public function getPerson(): ?Person { return $this->person; } public function setPerson(?Person $person): self { $this->person = $person; return $this; } public function getOrganization(): ?Organization { return $this->organization; } public function setOrganization(?Organization $organization): self { $this->organization = $organization; return $this; } public function getActivityYear(): ?int { return $this->activityYear; } public function setActivityYear(?int $activityYear): self { $this->activityYear = $activityYear; return $this; } public function getHistorical(): array { return array_key_exists('historical', $this->setting) && $this->setting['historical'] ? $this->setting['historical'] : ['present' => true]; } public function setHistorical(array $historical): self { if(!$historical['past'] && !$historical['present'] && !$historical['future']) $historical['present'] = true; $this->setting['historical'] = $historical; return $this; } public function setRoles(?array $roles): self { $this->roles = $roles; return $this; } public function getRoles(): ?array { $roles = $this->roles; return array_unique($roles); } public function getPersonActivity(): Collection { return $this->personActivity; } public function addPersonActivity(PersonActivity $personActivity): self { if (!$this->personActivity->contains($personActivity)) { $this->personActivity[] = $personActivity; $personActivity->setAccess($this); } return $this; } public function removePersonActivity(PersonActivity $personActivity): self { if ($this->personActivity->removeElement($personActivity)) { // set the owning side to null (unless already changed) if ($personActivity->getAccess() === $this) { $personActivity->setAccess(null); } } return $this; } public function getOrganizationFunction(): Collection { return $this->organizationFunction; } public function addOrganizationFunction (OrganizationFunction $organizationFunction): self { if (!$this->organizationFunction->contains($organizationFunction)) { $this->organizationFunction[] = $organizationFunction; $organizationFunction->setAccess($this); } return $this; } public function removeOrganizationFunction(OrganizationFunction $organizationFunction): self { if ($this->organizationFunction->removeElement($organizationFunction)) { // set the owning side to null (unless already changed) if ($organizationFunction->getAccess() === $this) { $organizationFunction->setAccess(null); } } return $this; } public function getOrganizationLicences(): Collection { return $this->organizationLicences; } public function addOrganizationLicence(OrganizationLicence $organizationLicence): self { if (!$this->organizationLicences->contains($organizationLicence)) { $this->organizationLicences[] = $organizationLicence; $organizationLicence->setLicensee($this); } return $this; } public function removeOrganizationLicence(OrganizationLicence $organizationLicence): self { if ($this->organizationLicences->removeElement($organizationLicence)) { // set the owning side to null (unless already changed) if ($organizationLicence->getLicensee() === $this) { $organizationLicence->setLicensee(null); } } return $this; } public function getPersonalizedLists(): Collection { return $this->personalizedLists; } public function addPersonalizedList(PersonalizedList $personalizedList): self { if (!$this->personalizedLists->contains($personalizedList)) { $this->personalizedLists[] = $personalizedList; $personalizedList->setAccess($this); } return $this; } public function removePersonalizedList(PersonalizedList $personalizedList): self { if ($this->personalizedLists->removeElement($personalizedList)) { // set the owning side to null (unless already changed) if ($personalizedList->getAccess() === $this) { $personalizedList->setAccess(null); } } return $this; } public function getChildren(): Collection { return $this->children; } public function addChild (Access $access): self { if (!$this->children->contains($access)) { $this->children[] = $access; $access->addGuardian($this); } return $this; } public function removeChild(Access $access): self { if ($this->children->removeElement($access)) { $access->removeGuardian($this); } return $this; } public function getGuardians(): Collection { return $this->guardians; } public function addGuardian(Access $access): self { if (!$this->guardians->contains($access)) { $this->guardians[] = $access; $access->addChild($this); } return $this; } public function removeGuardian(Access $access): self { if ($this->guardians->removeElement($access)) { $access->removeChild($this); } return $this; } public function getBillingPayers(): Collection { return $this->billingPayers; } public function addBillingPayer(AccessPayer $billingPayer): self { if (!$this->billingPayers->contains($billingPayer)) { $this->billingPayers[] = $billingPayer; $billingPayer->setAccessPayer($this); } return $this; } public function removeBillingPayer(AccessPayer $billingPayer): self { if ($this->billingPayers->removeElement($billingPayer)) { // set the owning side to null (unless already changed) if ($billingPayer->getAccessPayer() === $this) { $billingPayer->setAccessPayer(null); } } return $this; } public function getBillingReceivers(): Collection { return $this->billingReceivers; } public function addBillingReceiver(AccessPayer $billingReceiver): self { if (!$this->billingReceivers->contains($billingReceiver)) { $this->billingReceivers[] = $billingReceiver; $billingReceiver->setAccessReceiver($this); } return $this; } public function removeBillingReceiver(AccessPayer $billingPayer): self { if ($this->billingReceivers->removeElement($billingPayer)) { // set the owning side to null (unless already changed) if ($billingPayer->getAccessReceiver() === $this) { $billingPayer->setAccessReceiver(null); } } return $this; } public function getAccessIntangibles(): Collection { return $this->accessIntangibles; } public function addAccessIntangible(AccessIntangible $accessIntangibles): self { if (!$this->accessIntangibles->contains($accessIntangibles)) { $this->accessIntangibles[] = $accessIntangibles; $accessIntangibles->setAccess($this); } return $this; } public function removeAccessIntangible(AccessIntangible $accessIntangibles): self { if ($this->accessIntangibles->removeElement($accessIntangibles)) { // set the owning side to null (unless already changed) if ($accessIntangibles->getAccess() === $this) { $accessIntangibles->setAccess(null); } } 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 { return $this->person->getUsername(); } public function getPassword(): ?string { return null; } public function getSalt(): ?string { return null; } public function getUsername(): ?string { return null; } public function eraseCredentials() { // TODO: Implement eraseCredentials() method. } }