*/ #[ORM\OneToMany(targetEntity: ContactLink::class, mappedBy: 'employee', cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['position' => 'ASC'])] private Collection $contactLinks; #[ORM\Column(type: 'datetime_immutable')] private \DateTimeImmutable $createdAt; #[ORM\Column(type: 'datetime_immutable')] private \DateTimeImmutable $updatedAt; public function __construct() { $this->id = Uuid::v7(); $this->shortCode = bin2hex(random_bytes(4)); $this->createdAt = new \DateTimeImmutable(); $this->updatedAt = new \DateTimeImmutable(); $this->contactLinks = new ArrayCollection(); } public function getShortCode(): ?string { return $this->shortCode; } public function ensureShortCode(): void { if (null === $this->shortCode) { $this->shortCode = bin2hex(random_bytes(4)); } } public function getId(): Uuid { return $this->id; } public function getFirstName(): string { return $this->firstName; } public function setFirstName(string $firstName): self { $this->firstName = $firstName; return $this; } public function getLastName(): string { return $this->lastName; } public function setLastName(string $lastName): self { $this->lastName = $lastName; return $this; } public function getSlug(): string { return $this->slug; } public function setSlug(string $slug): self { $this->slug = $slug; return $this; } public function getTitle(): ?string { return $this->title; } public function setTitle(?string $title): self { $this->title = $title; return $this; } public function getPosition(): ?string { return $this->position; } public function setPosition(?string $position): self { $this->position = $position; return $this; } public function getDepartment(): ?string { return $this->department; } public function setDepartment(?string $department): self { $this->department = $department; return $this; } public function getEmail(): ?string { return $this->email; } public function setEmail(?string $email): self { $this->email = $email; return $this; } public function getPhone(): ?string { return $this->phone; } public function setPhone(?string $phone): self { $this->phone = $phone; return $this; } public function getMobile(): ?string { return $this->mobile; } public function setMobile(?string $mobile): self { $this->mobile = $mobile; return $this; } public function getPhotoPath(): ?string { return $this->photoPath; } public function setPhotoPath(?string $photoPath): self { $this->photoPath = $photoPath; return $this; } public function getBio(): ?string { return $this->bio; } public function setBio(?string $bio): self { $this->bio = $bio; return $this; } public function getStatus(): string { return $this->status; } public function setStatus(string $status): self { $this->status = $status; return $this; } public function isSelfEditAllowed(): bool { return $this->selfEditAllowed; } public function setSelfEditAllowed(bool $selfEditAllowed): self { $this->selfEditAllowed = $selfEditAllowed; return $this; } /** @return string[] */ public function getEditableFields(): array { return $this->editableFields; } /** @param string[] $editableFields */ public function setEditableFields(array $editableFields): self { $this->editableFields = $editableFields; return $this; } public function getCompany(): Company { return $this->company; } public function setCompany(Company $company): self { $this->company = $company; return $this; } public function getLocation(): ?Location { return $this->location; } public function setLocation(?Location $location): self { $this->location = $location; return $this; } // --- Login/Auth --- public function getLoginEmail(): ?string { return $this->loginEmail; } public function setLoginEmail(?string $loginEmail): self { $this->loginEmail = $loginEmail; return $this; } public function hasLogin(): bool { return null !== $this->loginEmail && null !== $this->password; } #[Ignore] public function getUserIdentifier(): string { return (string) $this->loginEmail; } /** @return string[] */ public function getRoles(): array { $roles = $this->roles; $roles[] = 'ROLE_USER'; return array_values(array_unique($roles)); } /** @param string[] $roles */ public function setRoles(array $roles): self { $this->roles = $roles; return $this; } #[Ignore] public function getPassword(): ?string { return $this->password; } public function setPassword(?string $password): self { $this->password = $password; return $this; } public function eraseCredentials(): void { } /** @return Collection */ public function getContactLinks(): Collection { return $this->contactLinks; } public function addContactLink(ContactLink $link): self { if (!$this->contactLinks->contains($link)) { $this->contactLinks->add($link); $link->setEmployee($this); } return $this; } public function removeContactLink(ContactLink $link): self { $this->contactLinks->removeElement($link); return $this; } public function getReseller(): ?Reseller { return $this->company->getReseller(); } public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } public function getUpdatedAt(): \DateTimeImmutable { return $this->updatedAt; } public function touch(): void { $this->updatedAt = new \DateTimeImmutable(); } }