src/Entity/User.php line 24
<?phpnamespace App\Entity;use App\Repository\UserRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\DateType;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: UserRepository::class)]#[UniqueEntity(fields: ['email'],errorPath: 'email',message: 'Cet e-mail est déjà utilisée.',)]class User implements UserInterface, PasswordAuthenticatedUserInterface{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(name: 'email', type: 'string', length: 255)]#[Assert\Email(message: 'The email {{ value }} is not a valid email.',)]private ?string $email = null;#[ORM\Column]private array $roles = [];/*** @var string|null The hashed password*/#[ORM\Column(type: 'string')]private ?string $password = null;#[ORM\Column(length: 255)]private ?string $nom = null;#[ORM\Column(length: 255)]private ?string $prenom = null;#[ORM\Column(length: 255)]private ?string $sexe = null;#[ORM\Column(nullable: true)]private ?int $qs = null;#[ORM\Column(nullable: true)]private ?int $active = null;#[ORM\Column(type: 'string' , nullable: true)]private $brochureFilename;#[ORM\Column(type: Types::DATE_MUTABLE)]private ?\DateTimeInterface $date_naissance = null;#[ORM\ManyToOne(inversedBy: 'users')]private ?Coach $coach = null;#[ORM\Column(length: 255, nullable: true)]private ?string $photo = null;#[ORM\Column(type: Types::DATE_MUTABLE)]private ?\DateTimeInterface $date_ajout = null;#[ORM\OneToMany(mappedBy: 'user', targetEntity: UserObjectif::class)]private Collection $userObjectif;#[ORM\OneToMany(mappedBy: 'user', targetEntity: UserSport::class)]private Collection $userSport;#[ORM\Column(type: Types::SMALLINT, nullable: true)]private ?int $apt = null;#[ORM\ManyToOne(inversedBy: 'users')]private ?Offre $offre = null;#[ORM\OneToMany(mappedBy: 'user', targetEntity: CarnetEntainement::class)]private Collection $carnetEntainements;public function __construct(){$this->date_ajout = new \DateTimeImmutable();$this->userObjectif = new ArrayCollection();$this->userSport = new ArrayCollection();$this->carnetEntainements = new ArrayCollection();}public function getId(): ?int{return $this->id;}public function getEmail(): ?string{return $this->email;}public function setEmail(string $email): self{$this->email = $email;return $this;}/*** A visual identifier that represents this user.** @see UserInterface*/public function getUserIdentifier(): string{return (string) $this->email;}/*** @see UserInterface*/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;}/*** @see PasswordAuthenticatedUserInterface*/public function getPassword(): string{return $this->password;}public function setPassword(string $password): self{$this->password = $password;return $this;}/*** @see UserInterface*/public function eraseCredentials(){// If you store any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;}public function getNom(): ?string{return $this->nom;}public function setNom(string $nom): self{$this->nom = $nom;return $this;}public function getPrenom(): ?string{return $this->prenom;}public function setPrenom(string $prenom): self{$this->prenom = $prenom;return $this;}public function getSexe(): ?string{return $this->sexe;}public function setSexe(string $sexe): self{$this->sexe = $sexe;return $this;}public function getQs(): ?int{return $this->qs;}public function setQs(?int $qs): self{$this->qs = $qs;return $this;}public function getActive(): ?int{return $this->active;}public function setActive(?int $active): self{$this->active = $active;return $this;}public function getDateNaissance(): ?\DateTimeInterface{return $this->date_naissance;}public function setDateNaissance(?\DateTimeInterface $date_naissance): static{$this->date_naissance = $date_naissance;return $this;}public function getBrochureFilename(): ?string{return $this->brochureFilename;}public function setBrochureFilename(string $brochureFilename): self{$this->brochureFilename = $brochureFilename;return $this;}public function getCoach(): ?Coach{return $this->coach;}public function setCoach(?Coach $coach): static{$this->coach = $coach;return $this;}public function getPhoto(): ?string{return $this->photo;}public function setPhoto(?string $photo): static{$this->photo = $photo;return $this;}public function getDateAjout(): ?\DateTimeInterface{return $this->date_ajout;}public function setDateAjout(\DateTimeInterface $date_ajout): static{$this->date_ajout = $date_ajout;return $this;}/*** @return Collection<int, UserObjectif>*/public function getUserObjectif(): Collection{return $this->userObjectif;}public function addUserObjectif(UserObjectif $userObjectif): static{if (!$this->userObjectif->contains($userObjectif)) {$this->userObjectif->add($userObjectif);$userObjectif->setUser($this);}return $this;}public function removeUserObjectif(UserObjectif $userObjectif): static{if ($this->userObjectif->removeElement($userObjectif)) {// set the owning side to null (unless already changed)if ($userObjectif->getUser() === $this) {$userObjectif->setUser(null);}}return $this;}/*** @return Collection<int, UserSport>*/public function getUserSport(): Collection{return $this->userSport;}public function addUserSport(UserSport $userSport): static{if (!$this->userSport->contains($userSport)) {$this->userSport->add($userSport);$userSport->setUser($this);}return $this;}public function removeUserSport(UserSport $userSport): static{if ($this->userSport->removeElement($userSport)) {// set the owning side to null (unless already changed)if ($userSport->getUser() === $this) {$userSport->setUser(null);}}return $this;}public function getApt(): ?int{return $this->apt;}public function setApt(?int $apt): static{$this->apt = $apt;return $this;}public function getOffre(): ?Offre{return $this->offre;}public function setOffre(?Offre $offre): static{$this->offre = $offre;return $this;}/*** @return Collection<int, CarnetEntainement>*/public function getCarnetEntainements(): Collection{return $this->carnetEntainements;}public function addCarnetEntainement(CarnetEntainement $carnetEntainement): static{if (!$this->carnetEntainements->contains($carnetEntainement)) {$this->carnetEntainements->add($carnetEntainement);$carnetEntainement->setUser($this);}return $this;}public function removeCarnetEntainement(CarnetEntainement $carnetEntainement): static{if ($this->carnetEntainements->removeElement($carnetEntainement)) {// set the owning side to null (unless already changed)if ($carnetEntainement->getUser() === $this) {$carnetEntainement->setUser(null);}}return $this;}}