src/Entity/User.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  8. use Symfony\Component\Security\Core\User\UserInterface;
  9. #[ORM\Entity(repositoryClassUserRepository::class)]
  10. class User implements UserInterfacePasswordAuthenticatedUserInterface
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private $id;
  16.     #[ORM\Column(type'string'length180uniquetrue)]
  17.     private $email;
  18.     #[ORM\Column(type'json')]
  19.     private $roles = [];
  20.     /**
  21.      * @var string The hashed password
  22.      */
  23.     #[ORM\Column(type'string')]
  24.     private $password;
  25.     #[ORM\Column(type'string'length255nullabletrue)]
  26.     private $nom;
  27.     #[ORM\Column(type'string'length255nullabletrue)]
  28.     private $prenom;
  29.     #[ORM\ManyToOne(targetEntityAgence::class, inversedBy'users'cascade: ['persist'])]
  30.     private $agence;
  31.     #[ORM\OneToMany(targetEntityProposition::class, mappedBy'auteur'cascade: ['persist'])]
  32.     private $propositions;
  33.     #[ORM\OneToMany(targetEntityDossier::class, mappedBy'auteur'cascade: ['persist'])]
  34.     private $dossiersAuteur;
  35.     #[ORM\OneToMany(targetEntityDossier::class, mappedBy'relecteur'cascade: ['persist'])]
  36.     private $dossiersRelecteur;
  37.     #[ORM\OneToMany(targetEntityDossier::class, mappedBy'validateur'cascade: ['persist'])]
  38.     private $dossiersValidateur;
  39.     #[ORM\OneToMany(targetEntityCourrier::class, mappedBy'auteur'cascade: ['persist'])]
  40.     private $courriers;
  41.     #[ORM\OneToMany(targetEntityAffaire::class, mappedBy'responsable'cascade: ['persist'])]
  42.     private $affaires;
  43.     #[ORM\Column(type'datetime'nullabletrue)]
  44.     private $createdAt;
  45.     #[ORM\Column(type'datetime'nullabletrue)]
  46.     private $updatedAt;
  47.     #[ORM\Column(type'string'length255nullabletrue)]
  48.     private $telephone;
  49.     #[ORM\Column(type'boolean'nullabletrue)]
  50.     private $actif true;
  51.     #[ORM\Column(type'string'length255nullabletrue)]
  52.     private $trigramme;
  53.     public function __toString()
  54.     {
  55.         $trigramme=$this->getTrigramme();
  56.         if(!$trigramme){ $trigramme="non défini";}
  57.         return $trigramme;
  58.     }
  59.     public function __construct()
  60.     {
  61.         $this->setRoles(["ROLE_USER"]);
  62.         $this->propositions = new ArrayCollection();
  63.         $this->dossiersAuteur = new ArrayCollection();
  64.         $this->dossiersRelecteur = new ArrayCollection();
  65.         $this->dossiersValidateur = new ArrayCollection();
  66.         $this->courriers = new ArrayCollection();
  67.         $this->affaires = new ArrayCollection();
  68.     }
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getEmail(): ?string
  74.     {
  75.         return $this->email;
  76.     }
  77.     public function setEmail(string $email): self
  78.     {
  79.         $this->email $email;
  80.         return $this;
  81.     }
  82.     /**
  83.      * A visual identifier that represents this user.
  84.      *
  85.      * @see UserInterface
  86.      */
  87.     public function getUserIdentifier(): string
  88.     {
  89.         return (string) $this->email;
  90.     }
  91.     /**
  92.      * A visual identifier that represents this user.
  93.      *
  94.      * @see UserInterface
  95.      */
  96.     public function getUsername(): string
  97.     {
  98.         return (string) $this->email;
  99.     }
  100.     /**
  101.      * @see UserInterface
  102.      */
  103.     public function getRoles(): array
  104.     {
  105.         $roles $this->roles;
  106.         // guarantee every user at least has ROLE_USER
  107.         $roles[] = 'ROLE_USER';
  108.         return array_unique($roles);
  109.     }
  110.     public function setRoles(array $roles): self
  111.     {
  112.         $this->roles $roles;
  113.         return $this;
  114.     }
  115.     /**
  116.      * @see UserInterface
  117.      */
  118.     public function getPassword(): string
  119.     {
  120.         return (string) $this->password;
  121.     }
  122.     public function setPassword(string $password): self
  123.     {
  124.         $this->password $password;
  125.         return $this;
  126.     }
  127.     /**
  128.      * Returning a salt is only needed, if you are not using a modern
  129.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  130.      *
  131.      * @see UserInterface
  132.      */
  133.     public function getSalt(): ?string
  134.     {
  135.         return null;
  136.     }
  137.     /**
  138.      * @see UserInterface
  139.      */
  140.     public function eraseCredentials()
  141.     {
  142.         // If you store any temporary, sensitive data on the user, clear it here
  143.         // $this->plainPassword = null;
  144.     }
  145.     public function getNom(): ?string
  146.     {
  147.         return $this->nom;
  148.     }
  149.     public function setNom(?string $nom): self
  150.     {
  151.         $this->nom $nom;
  152.         return $this;
  153.     }
  154.     public function getPrenom(): ?string
  155.     {
  156.         return $this->prenom;
  157.     }
  158.     public function setPrenom(?string $prenom): self
  159.     {
  160.         $this->prenom $prenom;
  161.         return $this;
  162.     }
  163.     public function getAgence(): ?Agence
  164.     {
  165.         return $this->agence;
  166.     }
  167.     public function setAgence(?Agence $agence): self
  168.     {
  169.         $this->agence $agence;
  170.         return $this;
  171.     }
  172.     /**
  173.      * @return Collection|Proposition[]
  174.      */
  175.     public function getPropositions(): Collection
  176.     {
  177.         return $this->propositions;
  178.     }
  179.     public function addProposition(Proposition $proposition): self
  180.     {
  181.         if (!$this->propositions->contains($proposition)) {
  182.             $this->propositions[] = $proposition;
  183.             $proposition->setAuteur($this);
  184.         }
  185.         return $this;
  186.     }
  187.     public function removeProposition(Proposition $proposition): self
  188.     {
  189.         if ($this->propositions->removeElement($proposition)) {
  190.             // set the owning side to null (unless already changed)
  191.             if ($proposition->getAuteur() === $this) {
  192.                 $proposition->setAuteur(null);
  193.             }
  194.         }
  195.         return $this;
  196.     }
  197.     /**
  198.      * @return Collection|Dossier[]
  199.      */
  200.     public function getDossiersAuteur(): Collection
  201.     {
  202.         return $this->dossiersAuteur;
  203.     }
  204.     public function addDossiersAuteur(Dossier $dossiersAuteur): self
  205.     {
  206.         if (!$this->dossiersAuteur->contains($dossiersAuteur)) {
  207.             $this->dossiersAuteur[] = $dossiersAuteur;
  208.             $dossiersAuteur->setAuteur($this);
  209.         }
  210.         return $this;
  211.     }
  212.     public function removeDossiersAuteur(Dossier $dossiersAuteur): self
  213.     {
  214.         if ($this->dossiersAuteur->removeElement($dossiersAuteur)) {
  215.             // set the owning side to null (unless already changed)
  216.             if ($dossiersAuteur->getAuteur() === $this) {
  217.                 $dossiersAuteur->setAuteur(null);
  218.             }
  219.         }
  220.         return $this;
  221.     }
  222.     /**
  223.      * @return Collection|Dossier[]
  224.      */
  225.     public function getDossiersRelecteur(): Collection
  226.     {
  227.         return $this->dossiersRelecteur;
  228.     }
  229.     public function addDossiersRelecteur(Dossier $dossiersRelecteur): self
  230.     {
  231.         if (!$this->dossiersRelecteur->contains($dossiersRelecteur)) {
  232.             $this->dossiersRelecteur[] = $dossiersRelecteur;
  233.             $dossiersRelecteur->setRelecteur($this);
  234.         }
  235.         return $this;
  236.     }
  237.     public function removeDossiersRelecteur(Dossier $dossiersRelecteur): self
  238.     {
  239.         if ($this->dossiersRelecteur->removeElement($dossiersRelecteur)) {
  240.             // set the owning side to null (unless already changed)
  241.             if ($dossiersRelecteur->getRelecteur() === $this) {
  242.                 $dossiersRelecteur->setRelecteur(null);
  243.             }
  244.         }
  245.         return $this;
  246.     }
  247.     /**
  248.      * @return Collection|Dossier[]
  249.      */
  250.     public function getDossiersValidateur(): Collection
  251.     {
  252.         return $this->dossiersValidateur;
  253.     }
  254.     public function addDossiersValidateur(Dossier $dossiersValidateur): self
  255.     {
  256.         if (!$this->dossiersValidateur->contains($dossiersValidateur)) {
  257.             $this->dossiersValidateur[] = $dossiersValidateur;
  258.             $dossiersValidateur->setValidateur($this);
  259.         }
  260.         return $this;
  261.     }
  262.     public function removeDossiersValidateur(Dossier $dossiersValidateur): self
  263.     {
  264.         if ($this->dossiersValidateur->removeElement($dossiersValidateur)) {
  265.             // set the owning side to null (unless already changed)
  266.             if ($dossiersValidateur->getValidateur() === $this) {
  267.                 $dossiersValidateur->setValidateur(null);
  268.             }
  269.         }
  270.         return $this;
  271.     }
  272.     /**
  273.      * @return Collection|Courrier[]
  274.      */
  275.     public function getCourriers(): Collection
  276.     {
  277.         return $this->courriers;
  278.     }
  279.     public function addCourrier(Courrier $courrier): self
  280.     {
  281.         if (!$this->courriers->contains($courrier)) {
  282.             $this->courriers[] = $courrier;
  283.             $courrier->setAuteur($this);
  284.         }
  285.         return $this;
  286.     }
  287.     public function removeCourrier(Courrier $courrier): self
  288.     {
  289.         if ($this->courriers->removeElement($courrier)) {
  290.             // set the owning side to null (unless already changed)
  291.             if ($courrier->getAuteur() === $this) {
  292.                 $courrier->setAuteur(null);
  293.             }
  294.         }
  295.         return $this;
  296.     }
  297.     /**
  298.      * @return Collection|Affaire[]
  299.      */
  300.     public function getAffaires(): Collection
  301.     {
  302.         return $this->affaires;
  303.     }
  304.     public function addAffaire(Affaire $affaire): self
  305.     {
  306.         if (!$this->affaires->contains($affaire)) {
  307.             $this->affaires[] = $affaire;
  308.             $affaire->setResponsable($this);
  309.         }
  310.         return $this;
  311.     }
  312.     public function removeAffaire(Affaire $affaire): self
  313.     {
  314.         if ($this->affaires->removeElement($affaire)) {
  315.             // set the owning side to null (unless already changed)
  316.             if ($affaire->getResponsable() === $this) {
  317.                 $affaire->setResponsable(null);
  318.             }
  319.         }
  320.         return $this;
  321.     }
  322.     public function getCreatedAt(): ?\DateTimeInterface
  323.     {
  324.         return $this->createdAt;
  325.     }
  326.     public function setCreatedAt(?\DateTimeInterface $createdAt): self
  327.     {
  328.         $this->createdAt $createdAt;
  329.         return $this;
  330.     }
  331.     public function getUpdatedAt(): ?\DateTimeInterface
  332.     {
  333.         return $this->updatedAt;
  334.     }
  335.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  336.     {
  337.         $this->updatedAt $updatedAt;
  338.         return $this;
  339.     }
  340.     private $plainPassword null;
  341.     public function getPlainPassword(): ?string
  342.     {
  343.         return $this->plainPassword;
  344.     }
  345.     public function setPlainPassword(string $password): void
  346.     {
  347.         $this->plainPassword $password;
  348.     }
  349.     public function getTelephone(): ?string
  350.     {
  351.         return $this->telephone;
  352.     }
  353.     public function setTelephone(?string $telephone): self
  354.     {
  355.         $this->telephone $telephone;
  356.         return $this;
  357.     }
  358.     public function getActif(): ?bool
  359.     {
  360.         return $this->actif;
  361.     }
  362.     public function setActif(?bool $actif): self
  363.     {
  364.         $this->actif $actif;
  365.         return $this;
  366.     }
  367.     public function getTrigramme(): ?string
  368.     {
  369.         return $this->trigramme;
  370.     }
  371.     public function setTrigramme(?string $trigramme): self
  372.     {
  373.         $this->trigramme $trigramme;
  374.         return $this;
  375.     }
  376. }