src/Entity/User.php line 20
<?phpnamespace App\Entity;use Cocur\Slugify\Slugify;use Doctrine\ORM\Mapping as ORM;use App\Repository\UserRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Validator\Constraints as Assert;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;#[ORM\Entity(repositoryClass: UserRepository::class)]#[ORM\Table(name: '`user`')]#[ORM\HasLifecycleCallbacks]#[UniqueEntity(fields: ['email'], message: 'Il existe déjà un compte avec cette adresse e-mail')]class User implements UserInterface, PasswordAuthenticatedUserInterface{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(type: 'string', length:255)]#[Assert\NotBlank(message: "Veuillez renseigner ce champ")]private $denomination;#[ORM\Column(type: 'string', length: 255)]private $contactEntreprise;#[ORM\Column(type: 'string', length: 255)]#[Assert\NotBlank(message: "Veuillez renseigner un email valide")]private $emailEntreprise;#[ORM\Column(type: 'string', length: 255)]#[Assert\NotBlank(message: "Veuillez renseigner ce champ")]private $nomPrenom;#[ORM\Column(type: 'string', length: 255)]private $contactInterlocuteur;#[ORM\Column(type: 'string', length: 255)]private $fonction;#[ORM\Column(length: 180, unique: true)]private ?string $email = null;/*** @var string The hashed password*/#[ORM\Column]private ?string $password = null;#[Assert\EqualTo(propertyPath:"password", message: "Les deux mot de passes ne sont pas identiques")]public $passwordConfirm;#[ORM\Column(type: 'string', length: 255)]private $slug;#[ORM\Column]private ?\DateTime $createdAt = null;#[ORM\Column(type: 'string', length: 255)]private $adresse;#[ORM\Column]private ?bool $active = null;#[ORM\OneToMany(mappedBy: 'clientAssocie', targetEntity: Ce::class)]private $userCes;#[ORM\OneToMany(mappedBy: 'clientAssocie', targetEntity: Cv::class)]private Collection $userCvs;// #[ORM\OneToMany(mappedBy: 'clientAssocie', targetEntity: Cv::class)]// private $cvs;#[ORM\Column(type: 'json')]private $roles = [];#[ORM\ManyToOne(inversedBy: 'users')]#[ORM\JoinColumn(nullable: false)]private ?TypeUser $typesUser = null;#[ORM\Column(type: 'boolean')]private $isVerified = false;// #[ORM\ManyToOne(targetEntity: TypeUser::class, inversedBy: 'users')]// #[ORM\JoinColumn(nullable: false)]// private $typeUser;public function __construct(){$this->userCes = new ArrayCollection();//$this->cvs = new ArrayCollection();//$this->userRoles = ArrayCollection();$this->userCvs = new ArrayCollection();}/*** Fonction permettant d'initialiser le slug de l'utilisateur* @return void*/#[ORM\PrePersist]#[ORM\PreUpdate]public function creationSlug(){if (empty($this->slug)) {$slugify = new Slugify();$this->slug = $slugify->slugify($this->denomination);}}/*** Fonction permettant de calculer le prix en fonction de la durée du séjour et de mettre automatiquement* à jours la date de reservation*/#[ORM\PrePersist]public function prePersist(){if (empty($this->createdAt)) {$this->createdAt = new \DateTime();}}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;// if(empty($roles)){// // guarantee every user at least has ROLE_USER// $roles[] = 'ROLE_USER';// }return array_unique($roles);}public function hasRole($roles){$user_role = $this->getRoles();if (!in_array($roles, $user_role)) {return false;}return true;}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;}//Fonction permettant de retourner le nom d'utilisateurpublic function getUsername(){return $this->email;}// /**// * Get the value of typeUser// */// public function getTypeUser()// {// return $this->typeUser;// }// /**// * Set the value of typeUser// *// * @return self// */// public function setTypeUser($typeUser)// {// $this->typeUser = $typeUser;// return $this;// }/*** Get the value of adresse*/public function getAdresse(){return $this->adresse;}/*** Set the value of adresse** @return self*/public function setAdresse($adresse){$this->adresse = $adresse;return $this;}/*** Get the value of active*/public function getActive(): ?bool{return $this->active;}/*** Set the value of active** @return self*/public function setActive(bool $active): self{$this->active = $active;return $this;}/*** Get the value of userCes* @return Collection|Ce[]*/public function getUserCes(): Collection{return $this->userCes;}/*** Set the value of userCes** @return self*/public function addUserCe(Ce $userCe): self{if (!$this->userCes->contains($userCe)) {$this->userCes[] = $userCe;$userCe->setClientAssocie($this);}return $this;}public function removeUserCe(Ce $userCe): self{if ($this->userCes->contains($userCe)) {$this->userCes->removeElement($userCe);// set the owning side to null (unless already changed)if ($userCe->getClientAssocie() === $this) {$userCe->setClientAssocie(null);}}return $this;}// /**// * @return Collection|Cv[]// */// public function getCvs(): Collection// {// return $this->cvs;// }// public function addCv(Cv $cv): self// {// if (!$this->cvs->contains($cv)) {// $this->cvs[] = $cv;// $cv->setClientAssocie($this);// }// return $this;// }// public function removeCv(Cv $cv): self// {// if ($this->cvs->contains($cv)) {// $this->cvs->removeElement($cv);// // set the owning side to null (unless already changed)// if ($cv->getClientAssocie() === $this) {// $cv->setClientAssocie(null);// }// }// return $this;// }/*** Get the value of contactEntreprise*/public function getContactEntreprise(): ?string{return $this->contactEntreprise;}/*** Set the value of contactEntreprise** @return self*/public function setContactEntreprise(string $contactEntreprise): self{$this->contactEntreprise = $contactEntreprise;return $this;}/*** Get the value of emailEntreprise*/public function getEmailEntreprise(): ?string{return $this->emailEntreprise;}/*** Set the value of emailEntreprise** @return self*/public function setEmailEntreprise(string $emailEntreprise): self{$this->emailEntreprise = $emailEntreprise;return $this;}/*** Get the value of nomPrenom*/public function getNomPrenom(): ?string{return $this->nomPrenom;}/*** Set the value of nomPrenom** @return self*/public function setNomPrenom(string $nomPrenom): self{$this->nomPrenom = $nomPrenom;return $this;}/*** Get the value of contactInterlocuteur*/public function getContactInterlocuteur(): ?string{return $this->contactInterlocuteur;}/*** Set the value of contactInterlocuteur** @return self*/public function setContactInterlocuteur(string $contactInterlocuteur): self{$this->contactInterlocuteur = $contactInterlocuteur;return $this;}/*** Get the value of fonction*/public function getFonction(): ?string{return $this->fonction;}/*** Set the value of fonction** @return self*/public function setFonction(string $fonction){$this->fonction = $fonction;return $this;}/*** Get the value of denomination*/public function getDenomination(){return $this->denomination;}/*** Set the value of denomination** @return self*/public function setDenomination(string $denomination): self{$this->denomination = $denomination;return $this;}public function getSalt(): ?string{return null;}public function getCreatedAt(): ?\DateTimeInterface{return $this->createdAt;}public function setCreatedAt(\DateTimeInterface $createdAt): self{$this->createdAt = $createdAt;return $this;}/*** @return Collection<int, Cv>*/public function getUserCvs(): Collection{return $this->userCvs;}public function addUserCv(Cv $userCv): self{if (!$this->userCvs->contains($userCv)) {$this->userCvs->add($userCv);$userCv->setClientAssocie($this);}return $this;}public function removeUserCv(Cv $userCv): self{if ($this->userCvs->removeElement($userCv)) {// set the owning side to null (unless already changed)if ($userCv->getClientAssocie() === $this) {$userCv->setClientAssocie(null);}}return $this;}public function getTypesUser(): ?TypeUser{return $this->typesUser;}public function setTypesUser(?TypeUser $typesUser): self{$this->typesUser = $typesUser;return $this;}/*** Get the value of slug*/public function getSlug(){return $this->slug;}/*** Set the value of slug** @return self*/public function setSlug($slug){$this->slug = $slug;return $this;}public function isVerified(): bool{return $this->isVerified;}public function setIsVerified(bool $isVerified): self{$this->isVerified = $isVerified;return $this;}}