src/Entity/ModUser.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ModUserRepository;
  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. /**
  10.  * @ORM\Entity(repositoryClass=ModUserRepository::class)
  11.  */
  12. class ModUser implements UserInterfacePasswordAuthenticatedUserInterface
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=180, unique=true)
  22.      */
  23.     private $username;
  24.     /**
  25.      * @ORM\Column(type="json")
  26.      */
  27.     private $roles = [];
  28.     /**
  29.      * @var string The hashed password
  30.      * @ORM\Column(type="string")
  31.      */
  32.     private $password;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=true)
  35.      */
  36.     private $email;
  37.     /**
  38.      * @ORM\Column(type="string", length=255, nullable=true)
  39.      */
  40.     private $telephone;
  41.     /**
  42.      * @ORM\Column(type="boolean")
  43.      */
  44.     private $cgu;
  45.     /**
  46.      * @ORM\Column(type="integer")
  47.      */
  48.     private $actif;
  49.     /**
  50.      * @ORM\Column(type="datetime")
  51.      */
  52.     private $dateCrea;
  53.     /**
  54.      * @ORM\Column(type="datetime")
  55.      */
  56.     private $dateModif;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=true)
  59.      */
  60.     private $codeVerif;
  61.     /**
  62.      * @ORM\OneToMany(targetEntity=ModPage::class, mappedBy="userCrea")
  63.      */
  64.     private $modPages;
  65.     /**
  66.      * @ORM\OneToMany(targetEntity=ModPage::class, mappedBy="userModif")
  67.      */
  68.     private $modPagesModif;
  69.     /**
  70.      * @ORM\OneToMany(targetEntity=ModTemplate::class, mappedBy="userCrea")
  71.      */
  72.     private $modTemplates;
  73.     /**
  74.      * @ORM\OneToMany(targetEntity=ModElement::class, mappedBy="userCrea")
  75.      */
  76.     private $modElementsCrea;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity=ModElement::class, mappedBy="userModif")
  79.      */
  80.     private $modElementsModif;
  81.     /**
  82.      * @ORM\OneToMany(targetEntity=ModIframe::class, mappedBy="userCrea", orphanRemoval=true)
  83.      */
  84.     private $modIframes;
  85.     /**
  86.      * @ORM\Column(type="string", length=255, nullable=true)
  87.      */
  88.     private $prenom;
  89.     /**
  90.      * @ORM\Column(type="string", length=255, nullable=true)
  91.      */
  92.     private $nom;
  93.     /**
  94.      * @ORM\Column(type="string", length=255, nullable=true)
  95.      */
  96.     private $societe;
  97.     public function __construct()
  98.     {
  99.         $this->modPages = new ArrayCollection();
  100.         $this->modPagesModif = new ArrayCollection();
  101.         $this->modTemplates = new ArrayCollection();
  102.         $this->modElementsCrea = new ArrayCollection();
  103.         $this->modElementsModif = new ArrayCollection();
  104.         $this->modIframes = new ArrayCollection();
  105.     }
  106.     public function getId(): ?int
  107.     {
  108.         return $this->id;
  109.     }
  110.     
  111.     /**
  112.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  113.      */
  114.     public function getUsername(): string
  115.     {
  116.         return (string) $this->username;
  117.     }
  118.     public function setUsername(string $username): self
  119.     {
  120.         $this->username $username;
  121.         return $this;
  122.     }
  123.     /**
  124.      * A visual identifier that represents this user.
  125.      *
  126.      * @see UserInterface
  127.      */
  128.     public function getUserIdentifier(): string
  129.     {
  130.         return (string) $this->username;
  131.     }
  132.     /**
  133.      * @see UserInterface
  134.      */
  135.     public function getRoles(): array
  136.     {
  137.         $roles $this->roles;
  138.         // guarantee every user at least has ROLE_USER
  139.         $roles[] = 'ROLE_USER';
  140.         return array_unique($roles);
  141.     }
  142.     public function setRoles(array $roles): self
  143.     {
  144.         $this->roles $roles;
  145.         return $this;
  146.     }
  147.     /**
  148.      * @see PasswordAuthenticatedUserInterface
  149.      */
  150.     public function getPassword(): string
  151.     {
  152.         return $this->password;
  153.     }
  154.     public function setPassword(string $password): self
  155.     {
  156.         $this->password $password;
  157.         return $this;
  158.     }
  159.     /**
  160.      * Returning a salt is only needed, if you are not using a modern
  161.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  162.      *
  163.      * @see UserInterface
  164.      */
  165.     public function getSalt(): ?string
  166.     {
  167.         return null;
  168.     }
  169.     /**
  170.      * @see UserInterface
  171.      */
  172.     public function eraseCredentials()
  173.     {
  174.         // If you store any temporary, sensitive data on the user, clear it here
  175.         // $this->plainPassword = null;
  176.     }
  177.     public function getEmail(): ?string
  178.     {
  179.         return $this->email;
  180.     }
  181.     public function setEmail(?string $email): self
  182.     {
  183.         $this->email $email;
  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 isCgu(): ?bool
  196.     {
  197.         return $this->cgu;
  198.     }
  199.     public function setCgu(bool $cgu): self
  200.     {
  201.         $this->cgu $cgu;
  202.         return $this;
  203.     }
  204.     public function getActif(): ?int
  205.     {
  206.         return $this->actif;
  207.     }
  208.     public function setActif(int $actif): self
  209.     {
  210.         $this->actif $actif;
  211.         return $this;
  212.     }
  213.     public function getDateCrea(): ?\DateTimeInterface
  214.     {
  215.         return $this->dateCrea;
  216.     }
  217.     public function setDateCrea(\DateTimeInterface $dateCrea): self
  218.     {
  219.         $this->dateCrea $dateCrea;
  220.         return $this;
  221.     }
  222.     public function getDateModif(): ?\DateTimeInterface
  223.     {
  224.         return $this->dateModif;
  225.     }
  226.     public function setDateModif(\DateTimeInterface $dateModif): self
  227.     {
  228.         $this->dateModif $dateModif;
  229.         return $this;
  230.     }
  231.     public function getCodeVerif(): ?string
  232.     {
  233.         return $this->codeVerif;
  234.     }
  235.     public function setCodeVerif(?string $codeVerif): self
  236.     {
  237.         $this->codeVerif $codeVerif;
  238.         return $this;
  239.     }
  240.     /**
  241.      * @return Collection<int, ModPage>
  242.      */
  243.     public function getModPages(): Collection
  244.     {
  245.         return $this->modPages;
  246.     }
  247.     public function addModPage(ModPage $modPage): self
  248.     {
  249.         if (!$this->modPages->contains($modPage)) {
  250.             $this->modPages[] = $modPage;
  251.             $modPage->setUserCrea($this);
  252.         }
  253.         return $this;
  254.     }
  255.     public function removeModPage(ModPage $modPage): self
  256.     {
  257.         if ($this->modPages->removeElement($modPage)) {
  258.             // set the owning side to null (unless already changed)
  259.             if ($modPage->getUserCrea() === $this) {
  260.                 $modPage->setUserCrea(null);
  261.             }
  262.         }
  263.         return $this;
  264.     }
  265.     /**
  266.      * @return Collection<int, ModPage>
  267.      */
  268.     public function getModPagesModif(): Collection
  269.     {
  270.         return $this->modPagesModif;
  271.     }
  272.     public function addModPagesModif(ModPage $modPagesModif): self
  273.     {
  274.         if (!$this->modPagesModif->contains($modPagesModif)) {
  275.             $this->modPagesModif[] = $modPagesModif;
  276.             $modPagesModif->setUserModif($this);
  277.         }
  278.         return $this;
  279.     }
  280.     public function removeModPagesModif(ModPage $modPagesModif): self
  281.     {
  282.         if ($this->modPagesModif->removeElement($modPagesModif)) {
  283.             // set the owning side to null (unless already changed)
  284.             if ($modPagesModif->getUserModif() === $this) {
  285.                 $modPagesModif->setUserModif(null);
  286.             }
  287.         }
  288.         return $this;
  289.     }
  290.     /**
  291.      * @return Collection<int, ModTemplate>
  292.      */
  293.     public function getModTemplates(): Collection
  294.     {
  295.         return $this->modTemplates;
  296.     }
  297.     public function addModTemplate(ModTemplate $modTemplate): self
  298.     {
  299.         if (!$this->modTemplates->contains($modTemplate)) {
  300.             $this->modTemplates[] = $modTemplate;
  301.             $modTemplate->setUserCrea($this);
  302.         }
  303.         return $this;
  304.     }
  305.     public function removeModTemplate(ModTemplate $modTemplate): self
  306.     {
  307.         if ($this->modTemplates->removeElement($modTemplate)) {
  308.             // set the owning side to null (unless already changed)
  309.             if ($modTemplate->getUserCrea() === $this) {
  310.                 $modTemplate->setUserCrea(null);
  311.             }
  312.         }
  313.         return $this;
  314.     }
  315.     /**
  316.      * @return Collection<int, ModElement>
  317.      */
  318.     public function getModElementsCrea(): Collection
  319.     {
  320.         return $this->modElementsCrea;
  321.     }
  322.     public function addModElementsCrea(ModElement $modElementsCrea): self
  323.     {
  324.         if (!$this->modElementsCrea->contains($modElementsCrea)) {
  325.             $this->modElementsCrea[] = $modElementsCrea;
  326.             $modElementsCrea->setUserCrea($this);
  327.         }
  328.         return $this;
  329.     }
  330.     public function removeModElementsCrea(ModElement $modElementsCrea): self
  331.     {
  332.         if ($this->modElementsCrea->removeElement($modElementsCrea)) {
  333.             // set the owning side to null (unless already changed)
  334.             if ($modElementsCrea->getUserCrea() === $this) {
  335.                 $modElementsCrea->setUserCrea(null);
  336.             }
  337.         }
  338.         return $this;
  339.     }
  340.     /**
  341.      * @return Collection<int, ModElement>
  342.      */
  343.     public function getModElementsModif(): Collection
  344.     {
  345.         return $this->modElementsModif;
  346.     }
  347.     public function addModElementsModif(ModElement $modElementsModif): self
  348.     {
  349.         if (!$this->modElementsModif->contains($modElementsModif)) {
  350.             $this->modElementsModif[] = $modElementsModif;
  351.             $modElementsModif->setUserModif($this);
  352.         }
  353.         return $this;
  354.     }
  355.     public function removeModElementsModif(ModElement $modElementsModif): self
  356.     {
  357.         if ($this->modElementsModif->removeElement($modElementsModif)) {
  358.             // set the owning side to null (unless already changed)
  359.             if ($modElementsModif->getUserModif() === $this) {
  360.                 $modElementsModif->setUserModif(null);
  361.             }
  362.         }
  363.         return $this;
  364.     }
  365.     /**
  366.      * @return Collection<int, ModIframe>
  367.      */
  368.     public function getModIframes(): Collection
  369.     {
  370.         return $this->modIframes;
  371.     }
  372.     public function addModIframe(ModIframe $modIframe): self
  373.     {
  374.         if (!$this->modIframes->contains($modIframe)) {
  375.             $this->modIframes[] = $modIframe;
  376.             $modIframe->setUserCrea($this);
  377.         }
  378.         return $this;
  379.     }
  380.     public function removeModIframe(ModIframe $modIframe): self
  381.     {
  382.         if ($this->modIframes->removeElement($modIframe)) {
  383.             // set the owning side to null (unless already changed)
  384.             if ($modIframe->getUserCrea() === $this) {
  385.                 $modIframe->setUserCrea(null);
  386.             }
  387.         }
  388.         return $this;
  389.     }
  390.     public function getPrenom(): ?string
  391.     {
  392.         return $this->prenom;
  393.     }
  394.     public function setPrenom(?string $prenom): self
  395.     {
  396.         $this->prenom $prenom;
  397.         return $this;
  398.     }
  399.     public function getNom(): ?string
  400.     {
  401.         return $this->nom;
  402.     }
  403.     public function setNom(?string $nom): self
  404.     {
  405.         $this->nom $nom;
  406.         return $this;
  407.     }
  408.     public function getSociete(): ?string
  409.     {
  410.         return $this->societe;
  411.     }
  412.     public function setSociete(?string $societe): self
  413.     {
  414.         $this->societe $societe;
  415.         return $this;
  416.     }
  417. }