*/ #[ORM\ManyToMany(targetEntity: Reservations::class, inversedBy: 'utilisateurs')] private Collection $Reservation; /** * @var Collection */ #[ORM\ManyToMany(targetEntity: Tables::class, inversedBy: 'utilisateurs')] private Collection $tables; public function __construct() { $this->Reservation = new ArrayCollection(); $this->tables = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getNom(): ?string { return $this->Nom; } public function setNom(string $Nom): static { $this->Nom = $Nom; return $this; } public function getPrenom(): ?string { return $this->Prenom; } public function setPrenom(string $Prenom): static { $this->Prenom = $Prenom; return $this; } public function getUserIdentifier(): string { return $this->Mail; } public function setUserIdentifier(string $userIdentifier): self { $this->Mail = $userIdentifier; return $this; } public function getPassword(): ?string { return $this->MotDePasse; } public function setPassword(string $MotDePasse): static { $this->MotDePasse = $MotDePasse; return $this; } public function getRoles(): array { return $this->Role; } public function getRolesAsString(): string { // Supprime le préfixe "ROLE_" et formate en majuscule seulement la première lettre $roles = array_map(function($role) { return ucfirst(strtolower(str_replace('ROLE_', '', $role))); }, $this->Role); return implode(', ', $roles); } public function setRoles(array $Role): self { $this->Role = $Role; return $this; } public function eraseCredentials(): void { // Méthode pour effacer les données sensibles (ex : plaintext password) } /** * @return Collection */ public function getReservation(): Collection { return $this->Reservation; } public function addReservation(Reservations $reservation): static { if (!$this->Reservation->contains($reservation)) { $this->Reservation->add($reservation); } return $this; } public function removeReservation(Reservations $reservation): static { $this->Reservation->removeElement($reservation); return $this; } /** * @return Collection */ public function getTables(): Collection { return $this->tables; } public function addTable(Tables $tables): static { if (!$this->tables->contains($tables)) { $this->tables->add($tables); } return $this; } public function removeTable(Tables $tables): static { $this->tables->removeElement($tables); return $this; } }