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.     /**
  82.      * @ORM\Column(type="integer", nullable=true)
  83.      */
  84.     private $politiqueTarifaireBudget;
  85.     public function __construct()
  86.     {
  87.         $this->faqs = new ArrayCollection();
  88.     }
  89.     public function getId(): ?int
  90.     {
  91.         return $this->id;
  92.     }
  93.     public function getEmail(): ?string
  94.     {
  95.         return $this->email;
  96.     }
  97.     public function setEmail(string $email): self
  98.     {
  99.         $this->email $email;
  100.         return $this;
  101.     }
  102.     /**
  103.      * A visual identifier that represents this user.
  104.      *
  105.      * @see UserInterface
  106.      */
  107.     public function getUserIdentifier(): string
  108.     {
  109.         return (string) $this->email;
  110.     }
  111.     /**
  112.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  113.      */
  114.     public function getUsername(): string
  115.     {
  116.         return (string) $this->email;
  117.     }
  118.     /**
  119.      * @see UserInterface
  120.      */
  121.     public function getRoles(): array
  122.     {
  123.         $roles $this->roles;
  124.         // guarantee every user at least has ROLE_USER
  125.         $roles[] = 'ROLE_USER';
  126.         return array_unique($roles);
  127.     }
  128.     public function setRoles(array $roles): self
  129.     {
  130.         $this->roles $roles;
  131.         return $this;
  132.     }
  133.     /**
  134.      * @see PasswordAuthenticatedUserInterface
  135.      */
  136.     public function getPassword(): string
  137.     {
  138.         return $this->password;
  139.     }
  140.     public function setPassword(string $password): self
  141.     {
  142.         $this->password $password;
  143.         return $this;
  144.     }
  145.     /**
  146.      * Returning a salt is only needed, if you are not using a modern
  147.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  148.      *
  149.      * @see UserInterface
  150.      */
  151.     public function getSalt(): ?string
  152.     {
  153.         return null;
  154.     }
  155.     /**
  156.      * @see UserInterface
  157.      */
  158.     public function eraseCredentials()
  159.     {
  160.         // If you store any temporary, sensitive data on the user, clear it here
  161.         // $this->plainPassword = null;
  162.     }
  163.     public function getCivilite(): ?string
  164.     {
  165.         return $this->civilite;
  166.     }
  167.     public function setCivilite(?string $civilite): self
  168.     {
  169.         $this->civilite $civilite;
  170.         return $this;
  171.     }
  172.     public function getNom(): ?string
  173.     {
  174.         return $this->nom;
  175.     }
  176.     public function setNom(?string $nom): self
  177.     {
  178.         $this->nom $nom;
  179.         return $this;
  180.     }
  181.     public function getPrenom(): ?string
  182.     {
  183.         return $this->prenom;
  184.     }
  185.     public function setPrenom(?string $prenom): self
  186.     {
  187.         $this->prenom $prenom;
  188.         return $this;
  189.     }
  190.     public function getTelephone(): ?string
  191.     {
  192.         return $this->telephone;
  193.     }
  194.     public function setTelephone(?string $telephone): self
  195.     {
  196.         $this->telephone $telephone;
  197.         return $this;
  198.     }
  199.     public function getDepartement(): ?string
  200.     {
  201.         return $this->departement;
  202.     }
  203.     public function setDepartement(?string $departement): self
  204.     {
  205.         $this->departement $departement;
  206.         return $this;
  207.     }
  208.     public function getFonction(): ?string
  209.     {
  210.         return $this->fonction;
  211.     }
  212.     public function setFonction(?string $fonction): self
  213.     {
  214.         $this->fonction $fonction;
  215.         return $this;
  216.     }
  217.     public function getCinema(): ?Cinema
  218.     {
  219.         return $this->cinema;
  220.     }
  221.     public function setCinema(?Cinema $cinema): self
  222.     {
  223.         $this->cinema $cinema;
  224.         return $this;
  225.     }
  226.     public function getCinemaGestion(): ?string
  227.     {
  228.         return $this->cinemaGestion;
  229.     }
  230.     public function setCinemaGestion(?string $cinemaGestion): self
  231.     {
  232.         $this->cinemaGestion $cinemaGestion;
  233.         return $this;
  234.     }
  235.     public function getBeneficiaire(): ?Beneficiaire
  236.     {
  237.         return $this->beneficiaire;
  238.     }
  239.     public function setBeneficiaire(?Beneficiaire $beneficiaire): self
  240.     {
  241.         $this->beneficiaire $beneficiaire;
  242.         return $this;
  243.     }
  244.     public function getPolitiqueTarifaireDptGestion(): ?string
  245.     {
  246.         return $this->politiqueTarifaireDptGestion;
  247.     }
  248.     public function setPolitiqueTarifaireDptGestion(?string $politiqueTarifaireDptGestion): self
  249.     {
  250.         $this->politiqueTarifaireDptGestion $politiqueTarifaireDptGestion;
  251.         return $this;
  252.     }
  253.     public function getPolitiqueTarifaireBudget(): ?int
  254.     {
  255.         return $this->politiqueTarifaireBudget;
  256.     }
  257.     public function setPolitiqueTarifaireBudget(?int $politiqueTarifaireBudget): self
  258.     {
  259.         $this->politiqueTarifaireBudget $politiqueTarifaireBudget;
  260.         return $this;
  261.     }
  262. }