src/Entity/User.php line 20
<?phpnamespace App\Entity;use App\Repository\UserRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;use Symfony\Component\Validator\Constraints as Assert;use OpenApi\Attributes as OA;/*#[UniqueEntity('email')]*/#[ORM\Entity(repositoryClass: UserRepository::class)]#[ORM\EntityListeners(['App\EntityListener\UserListener'])]class User implements UserInterface, PasswordAuthenticatedUserInterface{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column(type: 'integer')]private ?int $id;#[ORM\Column(type: 'string', length: 180, nullable: true)]#[Assert\Email()]#[Assert\Length(min: 2, max: 180)]private string $email;#[ORM\Column(type: 'json')]#[Assert\NotNull()]#[OA\Property(type: "array", items: new OA\Items(type: "string"))]private array $roles = [];private ?string $plainPassword = null;#[ORM\Column(type: 'string')]#[Assert\NotBlank()]// On init avec une chaine aléatoireprivate string $password = '643dfce2662dce89fbbb45cadaece3e0444144149e46f14232b00686e24cdf6e';#[ORM\Column(type: 'datetime_immutable')]#[Assert\NotNull()]private \DateTimeImmutable $createdAt;#[ORM\Column(type: 'datetime_immutable')]#[Assert\NotNull()]private \DateTimeImmutable $updatedAt;#[ORM\Column]private ?bool $enabled = null;#[ORM\Column(length: 255)]private ?string $firstName = null;#[ORM\Column(length: 255)]private ?string $lastName = null;#[ORM\Column(nullable: true)]private ?\DateTimeImmutable $connectedAt = null;/*#[ORM\Column(length: 50, unique: true)]private ?string $identifier = null;*/#[ORM\Column(nullable: true)]private ?int $societe = null;#[ORM\Column(nullable: true)]private ?int $code_regroupement = null;#[ORM\Column(nullable: true)]private ?int $code_client = null;#[ORM\Column(length: 250, nullable: true)]private ?string $type_login = null;#[ORM\Column(length: 250, nullable: true)]private ?string $profil_alias = null;#[ORM\Column(length: 250, nullable: true)]private ?string $profil_nom = null;#[ORM\Column(length: 250, nullable: true)]private ?string $email_client = null;#[ORM\Column(length: 250, nullable: true)]private ?string $nom = null;#[ORM\Column(length: 250)]private ?string $commande = null;#[ORM\Column(length: 250, nullable: true)]private ?string $maj_cde = null;#[ORM\Column(length: 250, nullable: true)]private ?string $valideur_cde = null;#[ORM\Column(length: 250, nullable: true)]private ?string $catalogue_general = null;#[ORM\Column(length: 250, nullable: true)]private ?string $logo_client = null;#[ORM\Column(length: 250, nullable: true)]private ?string $impu_web = null;#[ORM\Column(length: 250, nullable: true)]private ?string $blocage_cde = null;#[ORM\Column(length: 250, nullable: true)]private ?string $reference_cde = null;#[ORM\Column(length: 250, nullable: true)]private ?string $envoi_mail = null;#[ORM\Column(nullable: true)]private ?float $max_ht_cde = null;#[ORM\Column(nullable: true)]private ?float $montant_frais_de_port = null;#[ORM\Column(nullable: true)]private ?float $seuil_appli_du_port = null;#[ORM\Column(length: 250, nullable: true)]private ?string $devise = null;#[ORM\ManyToOne(inversedBy: 'users')]private ?Vendeur $vendeur = null;#[ORM\OneToMany(mappedBy: 'user', targetEntity: Tarif::class)]private Collection $tarifs;#[ORM\OneToMany(mappedBy: 'commandepar', targetEntity: Tarif::class)]private Collection $commandepar;#[ORM\OneToMany(mappedBy: 'commandepar', targetEntity: Commande400::class)]private Collection $commande400s;#[ORM\ManyToOne(inversedBy: 'users')]private ?AssistanteCommerciale $assistante = null;public function __construct(UserPasswordHasherInterface $passwordHasher){//Initilisation du mot de passe$this->setPlainPassword(bin2hex(random_bytes((64-(64%2))/2)));$this->password = $passwordHasher->hashPassword($this,$this->getPlainPassword());$this->createdAt = new \DateTimeImmutable();$this->updatedAt = new \DateTimeImmutable();$this->tarifs = new ArrayCollection();$this->commandepar = new ArrayCollection();$this->commande400s = 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->code_client;}/*** @see UserInterface*/public function getRoles(): array{$roles = $this->roles;if (count($roles) === 0 )$roles[] = 'ROLE_USER';return array_unique($roles);}/*** Test si l'utilisateur possède le rôle ADMIN*/public function isAdmin(): bool{return in_array('ROLE_ADMIN', $this->getRoles());}public function setRoles(array $roles): self{$this->roles = $roles;return $this;}/*** Get the value of plainPassword*/public function getPlainPassword(){return $this->plainPassword;}/*** Set the value of plainPassword** @return self*/public function setPlainPassword($plainPassword){$this->plainPassword = $plainPassword;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 getCreatedAt(): ?\DateTimeImmutable{return $this->createdAt;}public function setCreatedAt(\DateTimeImmutable $createdAt): self{$this->createdAt = $createdAt;return $this;}public function getUpdatedAt(): ?\DateTimeImmutable{return $this->updatedAt;}public function setUpdatedAt(\DateTimeImmutable $updatedAt): self{$this->updatedAt = $updatedAt;return $this;}public function isEnabled(): ?bool{return $this->enabled;}public function setEnabled(bool $enabled): self{$this->enabled = $enabled;return $this;}public function switchEnabled(): self{$enabled = ($this->enabled == true) ? 0 : 1;$this->enabled = $enabled;return $this;}public function getFirstName(): ?string{return $this->firstName;}public function setFirstName(string $firstName): self{$this->firstName = $firstName;return $this;}public function getLastName(): ?string{return $this->lastName;}public function getFullName(): ?string{return $this->firstName . ' ' . strtoupper($this->lastName);}public function setLastName(string $lastName): self{$this->lastName = $lastName;return $this;}public function getConnectedAt(): ?\DateTimeImmutable{return $this->connectedAt;}public function setConnectedAt(?\DateTimeImmutable $connectedAt): self{$this->connectedAt = $connectedAt;return $this;}/*public function getIdentifier(): ?string{return $this->identifier;}public function setIdentifier(string $identifier): self{$this->identifier = $identifier;return $this;}*/public function getSociete(): ?int{return $this->societe;}public function setSociete(?int $societe): self{$this->societe = $societe;return $this;}public function getCodeRegroupement(): ?int{return $this->code_regroupement;}public function setCodeRegroupement(?int $code_regroupement): self{$this->code_regroupement = $code_regroupement;return $this;}/*** A visual identifier that represents this user.** @see UserInterface*/public function getCodeClient(): ?int{return $this->code_client;}public function setCodeClient(?int $code_client): self{$this->code_client = $code_client;return $this;}public function getTypeLogin(): ?string{return $this->type_login;}public function setTypeLogin(?string $type_login): self{$this->type_login = $type_login;return $this;}public function getProfilAlias(): ?string{return $this->profil_alias;}public function setProfilAlias(?string $profil_alias): self{$this->profil_alias = $profil_alias;return $this;}public function getProfilNom(): ?string{return $this->profil_nom;}public function setProfilNom(?string $profil_nom): self{$this->profil_nom = $profil_nom;return $this;}public function getEmailClient(): ?string{return $this->email_client;}public function setEmailClient(?string $email_client): self{$this->email_client = $email_client;return $this;}public function getNom(): ?string{return $this->nom;}public function setNom(?string $nom): self{$this->nom = $nom;return $this;}public function getCommande(): ?string{return $this->commande;}public function setCommande(string $commande): self{$this->commande = $commande;return $this;}public function getMajCde(): ?string{return $this->maj_cde;}public function setMajCde(?string $maj_cde): self{$this->maj_cde = $maj_cde;return $this;}public function getValideurCde(): ?string{return $this->valideur_cde;}public function setValideurCde(?string $valideur_cde): self{$this->valideur_cde = $valideur_cde;return $this;}public function getCatalogueGeneral(): ?string{return $this->catalogue_general;}public function setCatalogueGeneral(?string $catalogue_general): self{$this->catalogue_general = $catalogue_general;return $this;}public function getLogoClient(): ?string{return $this->logo_client;}public function setLogoClient(?string $logo_client): self{$this->logo_client = $logo_client;return $this;}public function getImpuWeb(): ?string{return $this->impu_web;}public function setImpuWeb(?string $impu_web): self{$this->impu_web = $impu_web;return $this;}public function getBlocageCde(): ?string{return $this->blocage_cde;}public function setBlocageCde(?string $blocage_cde): self{$this->blocage_cde = $blocage_cde;return $this;}public function getReferenceCde(): ?string{return $this->reference_cde;}public function setReferenceCde(?string $reference_cde): self{$this->reference_cde = $reference_cde;return $this;}public function getEnvoiMail(): ?string{return $this->envoi_mail;}public function setEnvoiMail(?string $envoi_mail): self{$this->envoi_mail = $envoi_mail;return $this;}public function getMaxHtCde(): ?float{return $this->max_ht_cde;}public function setMaxHtCde(?float $max_ht_cde): self{$this->max_ht_cde = $max_ht_cde;return $this;}public function getMontantFraisDePort(): ?float{return $this->montant_frais_de_port;}public function setMontantFraisDePort(?float $montant_frais_de_port): self{$this->montant_frais_de_port = $montant_frais_de_port;return $this;}public function getSeuilAppliDuPort(): ?float{return $this->seuil_appli_du_port;}public function setSeuilAppliDuPort(?float $seuil_appli_du_port): self{$this->seuil_appli_du_port = $seuil_appli_du_port;return $this;}public function getDevise(): ?string{return $this->devise;}public function setDevise(?string $devise): self{$this->devise = $devise;return $this;}public function getVendeur(): ?Vendeur{return $this->vendeur;}public function setVendeur(?Vendeur $vendeur): self{$this->vendeur = $vendeur;return $this;}/*** @return Collection<int, Tarif>*/public function getTarifs(): Collection{return $this->tarifs;}public function addTarif(Tarif $tarif): self{if (!$this->tarifs->contains($tarif)) {$this->tarifs->add($tarif);$tarif->setUser($this);}return $this;}public function removeTarif(Tarif $tarif): self{if ($this->tarifs->removeElement($tarif)) {// set the owning side to null (unless already changed)if ($tarif->getUser() === $this) {$tarif->setUser(null);}}return $this;}/*** @return Collection<int, Tarif>*/public function getCommandepar(): Collection{return $this->commandepar;}public function addCommandepar(Tarif $commandepar): self{if (!$this->commandepar->contains($commandepar)) {$this->commandepar->add($commandepar);$commandepar->setCommandepar($this);}return $this;}public function removeCommandepar(Tarif $commandepar): self{if ($this->commandepar->removeElement($commandepar)) {// set the owning side to null (unless already changed)if ($commandepar->getCommandepar() === $this) {$commandepar->setCommandepar(null);}}return $this;}/*** @return Collection<int, Commande400>*/public function getCommande400s(): Collection{return $this->commande400s;}public function addCommande400(Commande400 $commande400): self{if (!$this->commande400s->contains($commande400)) {$this->commande400s->add($commande400);$commande400->setCommandepar($this);}return $this;}public function removeCommande400(Commande400 $commande400): self{if ($this->commande400s->removeElement($commande400)) {// set the owning side to null (unless already changed)if ($commande400->getCommandepar() === $this) {$commande400->setCommandepar(null);}}return $this;}public function getAssistante(): ?AssistanteCommerciale{return $this->assistante;}public function setAssistante(?AssistanteCommerciale $assistante): self{$this->assistante = $assistante;return $this;}}