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