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\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  8. use Symfony\Component\Security\Core\User\UserInterface;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use Rollerworks\Component\PasswordStrength\Validator\Constraints as RollerworksPassword;
  11. /**
  12.  * @ORM\Entity(repositoryClass=UserRepository::class)
  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 $email;
  26.     /**
  27.      * @ORM\Column(type="json")
  28.      */
  29.     private $roles = [];
  30.     /**
  31.      * @var string The hashed password
  32.      * @RollerworksPassword\PasswordStrength(
  33.      *     minLength=8,
  34.      *     minStrength=3,
  35.      *     tooShortMessage = "Le mot de passe doit comporter au moins 8 caractères",
  36.      *     message = "Doit contenir au moins 8 caractères dont au moins une lettre majuscule, une lettre minuscule et une chiffre",
  37.      * )
  38.      * @ORM\Column(type="string")
  39.      */
  40.     private $password;
  41.     /**
  42.      * @ORM\Column(type="string", length=15, nullable=true)
  43.      */
  44.     private $civilite;
  45.     /**
  46.      * @ORM\Column(type="string", length=50, nullable=true)
  47.      */
  48.     private $nom;
  49.     /**
  50.      * @ORM\Column(type="string", length=50, nullable=true)
  51.      */
  52.     private $prenom;
  53.     /**
  54.      * @ORM\Column(type="string", length=15, nullable=true)
  55.      */
  56.     private $telephone;
  57.     /**
  58.      * @ORM\Column(type="string", length=10, nullable=true)
  59.      */
  60.     private $departement;
  61.     /**
  62.      * @ORM\Column(type="string", length=255, nullable=true)
  63.      */
  64.     private $fonction;
  65.     /**
  66.      * @ORM\ManyToOne(targetEntity=Cinema::class, inversedBy="users")
  67.      */
  68.     private $cinema;
  69.     /**
  70.      * @ORM\Column(type="string", length=50, nullable=true)
  71.      */
  72.     private $cinemaGestion;
  73.     /**
  74.      * @ORM\ManyToOne(targetEntity=Beneficiaire::class, inversedBy="users")
  75.      */
  76.     private $beneficiaire;
  77.     /**
  78.      * @ORM\Column(type="string", length=15, nullable=true)
  79.      */
  80.     private $politiqueTarifaireDptGestion;
  81.     public function __construct()
  82.     {
  83.         $this->faqs = new ArrayCollection();
  84.     }
  85.     public function getId(): ?int
  86.     {
  87.         return $this->id;
  88.     }
  89.     public function getEmail(): ?string
  90.     {
  91.         return $this->email;
  92.     }
  93.     public function setEmail(string $email): self
  94.     {
  95.         $this->email $email;
  96.         return $this;
  97.     }
  98.     /**
  99.      * A visual identifier that represents this user.
  100.      *
  101.      * @see UserInterface
  102.      */
  103.     public function getUserIdentifier(): string
  104.     {
  105.         return (string) $this->email;
  106.     }
  107.     /**
  108.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  109.      */
  110.     public function getUsername(): string
  111.     {
  112.         return (string) $this->email;
  113.     }
  114.     /**
  115.      * @see UserInterface
  116.      */
  117.     public function getRoles(): array
  118.     {
  119.         $roles $this->roles;
  120.         // guarantee every user at least has ROLE_USER
  121.         $roles[] = 'ROLE_USER';
  122.         return array_unique($roles);
  123.     }
  124.     public function setRoles(array $roles): self
  125.     {
  126.         $this->roles $roles;
  127.         return $this;
  128.     }
  129.     /**
  130.      * @see PasswordAuthenticatedUserInterface
  131.      */
  132.     public function getPassword(): string
  133.     {
  134.         return $this->password;
  135.     }
  136.     public function setPassword(string $password): self
  137.     {
  138.         $this->password $password;
  139.         return $this;
  140.     }
  141.     /**
  142.      * Returning a salt is only needed, if you are not using a modern
  143.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  144.      *
  145.      * @see UserInterface
  146.      */
  147.     public function getSalt(): ?string
  148.     {
  149.         return null;
  150.     }
  151.     /**
  152.      * @see UserInterface
  153.      */
  154.     public function eraseCredentials()
  155.     {
  156.         // If you store any temporary, sensitive data on the user, clear it here
  157.         // $this->plainPassword = null;
  158.     }
  159.     public function getCivilite(): ?string
  160.     {
  161.         return $this->civilite;
  162.     }
  163.     public function setCivilite(?string $civilite): self
  164.     {
  165.         $this->civilite $civilite;
  166.         return $this;
  167.     }
  168.     public function getNom(): ?string
  169.     {
  170.         return $this->nom;
  171.     }
  172.     public function setNom(?string $nom): self
  173.     {
  174.         $this->nom $nom;
  175.         return $this;
  176.     }
  177.     public function getPrenom(): ?string
  178.     {
  179.         return $this->prenom;
  180.     }
  181.     public function setPrenom(?string $prenom): self
  182.     {
  183.         $this->prenom $prenom;
  184.         return $this;
  185.     }
  186.     public function getTelephone(): ?string
  187.     {
  188.         return $this->telephone;
  189.     }
  190.     public function setTelephone(?string $telephone): self
  191.     {
  192.         $this->telephone $telephone;
  193.         return $this;
  194.     }
  195.     public function getDepartement(): ?string
  196.     {
  197.         return $this->departement;
  198.     }
  199.     public function setDepartement(?string $departement): self
  200.     {
  201.         $this->departement $departement;
  202.         return $this;
  203.     }
  204.     public function getFonction(): ?string
  205.     {
  206.         return $this->fonction;
  207.     }
  208.     public function setFonction(?string $fonction): self
  209.     {
  210.         $this->fonction $fonction;
  211.         return $this;
  212.     }
  213.     public function getCinema(): ?Cinema
  214.     {
  215.         return $this->cinema;
  216.     }
  217.     public function setCinema(?Cinema $cinema): self
  218.     {
  219.         $this->cinema $cinema;
  220.         return $this;
  221.     }
  222.     public function getCinemaGestion(): ?string
  223.     {
  224.         return $this->cinemaGestion;
  225.     }
  226.     public function setCinemaGestion(?string $cinemaGestion): self
  227.     {
  228.         $this->cinemaGestion $cinemaGestion;
  229.         return $this;
  230.     }
  231.     public function getBeneficiaire(): ?Beneficiaire
  232.     {
  233.         return $this->beneficiaire;
  234.     }
  235.     public function setBeneficiaire(?Beneficiaire $beneficiaire): self
  236.     {
  237.         $this->beneficiaire $beneficiaire;
  238.         return $this;
  239.     }
  240.     public function getPolitiqueTarifaireDptGestion(): ?string
  241.     {
  242.         return $this->politiqueTarifaireDptGestion;
  243.     }
  244.     public function setPolitiqueTarifaireDptGestion(?string $politiqueTarifaireDptGestion): self
  245.     {
  246.         $this->politiqueTarifaireDptGestion $politiqueTarifaireDptGestion;
  247.         return $this;
  248.     }
  249. }