src/Entity/User.php line 19
<?phpnamespace App\Entity;use App\Repository\UserRepository;use App\Traits\UpdateInfoTrait;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;#[ORM\Table(name: '`user`')]#[ORM\Entity(repositoryClass: UserRepository::class)]#[Gedmo\Loggable]#[UniqueEntity(fields: 'email', message: "Cet email est déjà utilisé !")]class User implements UserInterface, PasswordAuthenticatedUserInterface{// Attention: Ne pas supprimeruse UpdateInfoTrait;#[ORM\OneToMany(mappedBy: "user", targetEntity: Reservation::class)]private Collection $liste_reservations;#[ORM\OneToMany(mappedBy: "user", targetEntity: Dons::class)]private Collection $liste_dons;#[Gedmo\Versioned]#[ORM\Column(name: 'email', type: Types::STRING, length: 255, unique: true)]private string $email;#[Gedmo\Versioned]#[ORM\Column(name: 'roles', type: Types::JSON)]private array $roles = [];#[Gedmo\Versioned]#[ORM\Column(name: 'password', type: Types::STRING, length: 255, nullable: true)]private ?string $password;#[Gedmo\Versioned]#[ORM\Column(name: 'lastname', type: Types::STRING, length: 255)]private string $lastname;#[Gedmo\Versioned]#[ORM\Column(name: 'firstname', type: Types::STRING, length: 255)]private string $firstname;#[Gedmo\Versioned]#[ORM\Column(name: 'phone', type: Types::STRING, length: 255)]private string $phone;#[ORM\Column(name: 'address', type: Types::STRING, length: 255, nullable: false)]private string $address;#[ORM\Column(name: 'address_complement', type: Types::STRING, length: 255, nullable: true)]private ?string $address_complement;#[ORM\Column(name: 'zip_code', type: Types::STRING, length: 255, nullable: false)]private string $zip_code;#[ORM\Column(name: 'city', type: Types::STRING, length: 255, nullable: false)]private string $city;#[ORM\ManyToOne(targetEntity: Pays::class)]#[ORM\JoinColumn(nullable: true)]private Pays $pays;public function __construct() { $this->setRoles(['ROLE_USER']); }public function getListeReservations(): Collection{return $this->liste_reservations;}public function setListeReservations(Collection $liste_reservations): User{$this->liste_reservations = $liste_reservations;return $this;}public function getListeDons(): Collection{return $this->liste_dons;}public function setListeDons(Collection $liste_dons): User{$this->liste_dons = $liste_dons;return $this;}public function getEmail(): ?string { return $this->email; }public function setEmail(string $email): self{$this->email = $email;return $this;}public function getUserIdentifier(): string { return (string) $this->email; }public function getRoles(): array{$roles = $this->roles;// guarantee every user at least has ROLE_USER$roles[] = 'ROLE_USER';return array_unique($roles);}public function setRoles(array $roles): self{$this->roles = $roles;return $this;}public function getPassword(): ?string { return $this->password; }public function setPassword(?string $password): self{$this->password = $password;return $this;}public function getLastname(): ?string { return $this->lastname; }public function setLastname(string $lastname): self{$this->lastname = $lastname;return $this;}public function getFirstname(): ?string { return $this->firstname; }public function setFirstname(string $firstname): self{$this->firstname = $firstname;return $this;}public function getPhone(): ?string { return $this->phone; }public function setPhone(string $phone): self{$this->phone = $phone;return $this;}public function getAddress(): string { return $this->address; }public function setAddress(string $address): User{$this->address = $address;return $this;}public function getAddressComplement(): ?string { return $this->address_complement; }public function setAddressComplement(?string $address_complement): User{$this->address_complement = $address_complement;return $this;}public function getZipCode(): string { return $this->zip_code; }public function setZipCode(string $zip_code): User{$this->zip_code = $zip_code;return $this;}public function getCity(): string { return $this->city; }public function setCity(string $city): User{$this->city = $city;return $this;}public function eraseCredentials(){// If you store any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;}public function hasRole(string $string): bool{return in_array($string, $this->getRoles());}public function getPays(): Pays{return $this->pays;}public function setPays(Pays $pays): void{$this->pays = $pays;}}