uuid = Uuid::v4(); } public function __toString() { return $this->getFullName(); } public function getId(): ?int { return $this->id; } public function getUuid(): string { return $this->uuid; } public function getBusProAddressId(): ?int { return $this->busProAddressId; } public function setBusProAddressId(int $busProAddressId): static { $this->busProAddressId = $busProAddressId; return $this; } public function getBusProPersonId(): ?int { return $this->busProPersonId; } public function setBusProPersonId(int $busProPersonId): static { $this->busProPersonId = $busProPersonId; return $this; } public function getFirstName(): ?string { return $this->firstName; } public function setFirstName(?string $firstName): static { $this->firstName = $firstName; return $this; } public function getLastName(): ?string { return $this->lastName; } public function setLastName(?string $lastName): static { $this->lastName = $lastName; return $this; } public function getFullName(bool $formal = false): string { if (true === $formal) { return sprintf('%s, %s', $this->getLastName(), $this->getFirstName()); } return sprintf('%s %s', $this->getFirstName(), $this->getLastName()); } public function getEmail(): ?string { return $this->email; } public function setEmail(string $email): static { $this->email = $email; return $this; } public function getRoles(): array { $roles = ['ROLE_USER', ...$this->roles]; if (in_array('ROLE_ADMIN', $this->roles) || in_array('ROLE_MANAGER', $this->roles)) { $roles[] = 'ROLE_ADMINISTRATIVE'; } return array_unique($roles); } public function setRoles(array $roles): static { $this->roles = $roles; return $this; } public function hasRole(string $role): bool { return in_array($role, $this->getRoles()); } public function getLastLoginAt(): ?\DateTimeImmutable { return $this->lastLoginAt; } public function setLastLoginAt(?\DateTimeImmutable $lastLoginAt): static { $this->lastLoginAt = $lastLoginAt; return $this; } public function getDefaultRoute(): string { if ($this->hasRole('ROLE_ADMIN')) { return 'app_admin_index'; } elseif ($this->hasRole('ROLE_MANAGER')) { return 'app_admin_index'; } elseif ($this->hasRole('ROLE_HOUSE_MANAGER')) { return 'app_house_manager_index'; } else { return 'app_teamer_index'; } } public function eraseCredentials(): void { } public function getUserIdentifier(): string { return $this->email; } public function getTeamer(): ?Teamer { return $this->teamer; } public function setTeamer(?Teamer $teamer): static { $this->teamer = $teamer; return $this; } public function getContact(): ?Contact { return $this->contact; } public function setContact(?Contact $contact): static { $this->contact = $contact; return $this; } public function getHotelCode(): ?string { return $this->hotelCode; } public function setHotelCode(?string $hotelCode): static { $this->hotelCode = $hotelCode; return $this; } }