src/Entity/User.php line 17

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\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  9. use Symfony\Component\Security\Core\User\UserInterface;
  10. /**
  11.  * @ORM\Entity(repositoryClass=UserRepository::class)
  12.  * @UniqueEntity(fields={"Entreprise","email"}, message="On compte existe déjà sous ce nom d'entreprise")
  13.  */
  14. class User implements UserInterfacePasswordAuthenticatedUserInterface
  15. {
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\GeneratedValue
  19.      * @ORM\Column(type="integer")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @ORM\Column(type="string", length=180, unique=true)
  24.      */
  25.     private $Entreprise;
  26.     /**
  27.      * @ORM\Column(type="json")
  28.      */
  29.     private $roles = [];
  30.     /**
  31.      * @var string The hashed password
  32.      * @ORM\Column(type="string")
  33.      */
  34.     private $password;
  35.     /**
  36.      * @ORM\Column(type="string", length=255, unique=true)
  37.      */
  38.     private $email;
  39.     /**
  40.      * @ORM\Column(type="datetime")
  41.      */
  42.     private $date_echeance;
  43.     /**
  44.      * @ORM\Column(type="integer")
  45.      */
  46.     private $etat;
  47.     /**
  48.      * @ORM\OneToMany(targetEntity=Cuvee::class, mappedBy="user")
  49.      */
  50.     private $cuvees;
  51.     /**
  52.      * @ORM\Column(type="string", length=255, nullable=true)
  53.      */
  54.     private $adresse;
  55.     /**
  56.      * @ORM\Column(type="string", length=255, nullable=true)
  57.      */
  58.     private $code_postal;
  59.     /**
  60.      * @ORM\Column(type="string", length=255, nullable=true)
  61.      */
  62.     private $ville;
  63.     /**
  64.      * @ORM\Column(type="string", length=255, nullable=true)
  65.      */
  66.     private $telephone;
  67.     /**
  68.      * @ORM\Column(type="string", length=255, nullable=true)
  69.      */
  70.     private $site;
  71.     /**
  72.      * @ORM\Column(type="string", length=255, nullable=true)
  73.      */
  74.     private $instagram;
  75.     /**
  76.      * @ORM\Column(type="string", length=255, nullable=true)
  77.      */
  78.     private $facebook;
  79.     /**
  80.      * @ORM\Column(type="text", nullable=true)
  81.      */
  82.     private $texte_domaine;
  83.     /**
  84.      * @ORM\Column(type="string", length=255, nullable=true)
  85.      */
  86.     private $image_profil;
  87.     /**
  88.      * @ORM\Column(type="string", length=255, nullable=true)
  89.      */
  90.     private $image_fond_profil;
  91.     public function __construct()
  92.     {
  93.         $this->cuvees = new ArrayCollection();
  94.     }
  95.     public function getId(): ?int
  96.     {
  97.         return $this->id;
  98.     }
  99.     public function getEntreprise(): ?string
  100.     {
  101.         return $this->Entreprise;
  102.     }
  103.     public function setEntreprise(string $Entreprise): self
  104.     {
  105.         $this->Entreprise $Entreprise;
  106.         return $this;
  107.     }
  108.     /**
  109.      * A visual identifier that represents this user.
  110.      *
  111.      * @see UserInterface
  112.      */
  113.     public function getUserIdentifier(): string
  114.     {
  115.         return (string) $this->Entreprise;
  116.     }
  117.     /**
  118.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  119.      */
  120.     public function getUsername(): string
  121.     {
  122.         return (string) $this->Entreprise;
  123.     }
  124.     /**
  125.      * @see UserInterface
  126.      */
  127.     public function getRoles(): array
  128.     {
  129.         $roles $this->roles;
  130.         // guarantee every user at least has ROLE_USER
  131.         $roles[] = 'ROLE_USER';
  132.         return array_unique($roles);
  133.     }
  134.     public function setRoles(array $roles): self
  135.     {
  136.         $this->roles $roles;
  137.         return $this;
  138.     }
  139.     /**
  140.      * @see PasswordAuthenticatedUserInterface
  141.      */
  142.     public function getPassword(): string
  143.     {
  144.         return $this->password;
  145.     }
  146.     public function setPassword(string $password): self
  147.     {
  148.         $this->password $password;
  149.         return $this;
  150.     }
  151.     /**
  152.      * Returning a salt is only needed, if you are not using a modern
  153.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  154.      *
  155.      * @see UserInterface
  156.      */
  157.     public function getSalt(): ?string
  158.     {
  159.         return null;
  160.     }
  161.     /**
  162.      * @see UserInterface
  163.      */
  164.     public function eraseCredentials()
  165.     {
  166.         // If you store any temporary, sensitive data on the user, clear it here
  167.         // $this->plainPassword = null;
  168.     }
  169.     public function getEmail(): ?string
  170.     {
  171.         return $this->email;
  172.     }
  173.     public function setEmail(string $email): self
  174.     {
  175.         $this->email $email;
  176.         return $this;
  177.     }
  178.     public function getDateEcheance(): ?\DateTimeInterface
  179.     {
  180.         return $this->date_echeance;
  181.     }
  182.     public function setDateEcheance(\DateTimeInterface $date_echeance): self
  183.     {
  184.         $this->date_echeance $date_echeance;
  185.         return $this;
  186.     }
  187.     public function getEtat(): ?int
  188.     {
  189.         return $this->etat;
  190.     }
  191.     public function setEtat(int $etat): self
  192.     {
  193.         $this->etat $etat;
  194.         return $this;
  195.     }
  196.     /**
  197.      * @return Collection<int, Cuvee>
  198.      */
  199.     public function getCuvees(): Collection
  200.     {
  201.         return $this->cuvees;
  202.     }
  203.     public function addCuvee(Cuvee $cuvee): self
  204.     {
  205.         if (!$this->cuvees->contains($cuvee)) {
  206.             $this->cuvees[] = $cuvee;
  207.             $cuvee->setUser($this);
  208.         }
  209.         return $this;
  210.     }
  211.     public function removeCuvee(Cuvee $cuvee): self
  212.     {
  213.         if ($this->cuvees->removeElement($cuvee)) {
  214.             // set the owning side to null (unless already changed)
  215.             if ($cuvee->getUser() === $this) {
  216.                 $cuvee->setUser(null);
  217.             }
  218.         }
  219.         return $this;
  220.     }
  221.     public function getAdresse(): ?string
  222.     {
  223.         return $this->adresse;
  224.     }
  225.     public function setAdresse(?string $adresse): self
  226.     {
  227.         $this->adresse $adresse;
  228.         return $this;
  229.     }
  230.     public function getCodePostal(): ?string
  231.     {
  232.         return $this->code_postal;
  233.     }
  234.     public function setCodePostal(?string $code_postal): self
  235.     {
  236.         $this->code_postal $code_postal;
  237.         return $this;
  238.     }
  239.     public function getVille(): ?string
  240.     {
  241.         return $this->ville;
  242.     }
  243.     public function setVille(?string $ville): self
  244.     {
  245.         $this->ville $ville;
  246.         return $this;
  247.     }
  248.     public function getTelephone(): ?string
  249.     {
  250.         return $this->telephone;
  251.     }
  252.     public function setTelephone(?string $telephone): self
  253.     {
  254.         $this->telephone $telephone;
  255.         return $this;
  256.     }
  257.     public function getSite(): ?string
  258.     {
  259.         return $this->site;
  260.     }
  261.     public function setSite(?string $site): self
  262.     {
  263.         $this->site $site;
  264.         return $this;
  265.     }
  266.     public function getInstagram(): ?string
  267.     {
  268.         return $this->instagram;
  269.     }
  270.     public function setInstagram(?string $instagram): self
  271.     {
  272.         $this->instagram $instagram;
  273.         return $this;
  274.     }
  275.     public function getFacebook(): ?string
  276.     {
  277.         return $this->facebook;
  278.     }
  279.     public function setFacebook(?string $facebook): self
  280.     {
  281.         $this->facebook $facebook;
  282.         return $this;
  283.     }
  284.     public function getTexteDomaine(): ?string
  285.     {
  286.         return $this->texte_domaine;
  287.     }
  288.     public function setTexteDomaine(?string $texte_domaine): self
  289.     {
  290.         $this->texte_domaine $texte_domaine;
  291.         return $this;
  292.     }
  293.     public function getImageProfil(): ?string
  294.     {
  295.         return $this->image_profil;
  296.     }
  297.     public function setImageProfil(?string $image_profil): self
  298.     {
  299.         $this->image_profil $image_profil;
  300.         return $this;
  301.     }
  302.     public function getImageFondProfil(): ?string
  303.     {
  304.         return $this->image_fond_profil;
  305.     }
  306.     public function setImageFondProfil(?string $image_fond_profil): self
  307.     {
  308.         $this->image_fond_profil $image_fond_profil;
  309.         return $this;
  310.     }
  311. }