src/Entity/Auth/AuthUser.php line 34

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Auth;
  3. use ApiPlatform\Core\Annotation\ApiFilter;
  4. use ApiPlatform\Core\Annotation\ApiResource;
  5. use App\Entity\AuthUserGroupeUser;
  6. use App\Entity\ClientRoleUser;
  7. use App\Entity\Evenement;
  8. use App\Entity\Suivi;
  9. use App\Entity\User;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\Common\Collections\Collection;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  14. use Symfony\Component\Security\Core\User\UserInterface;
  15. use Symfony\Component\Serializer\Annotation\Groups;
  16. use Symfony\Component\Validator\Constraints as Assert;
  17. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\OrderFilter;
  18. use ApiPlatform\Core\Bridge\Doctrine\Orm\Filter\BooleanFilter;
  19. /**
  20.  * @ORM\Entity(repositoryClass="App\Repository\AuthUserRepository")
  21.  * @UniqueEntity(fields="username", message="le nom d'utilisateur existe deja")
  22.  * @ApiResource(attributes={
  23.  *     "normalization_context"={"groups"={"auth-user-list"}},
  24.  *     "filters"= { "several","auth.user.search"},
  25.  *     "pagination_client_enabled"=true,
  26.  * })
  27.  * @ApiFilter(OrderFilter::class, properties={"user.prenom": "ASC"}, arguments={"orderParameterName" : "order"})
  28.  * @ApiFilter(BooleanFilter::class, properties={"uSysteme"})
  29.  */
  30. class AuthUser implements UserInterface
  31. {
  32.     /**
  33.      * @ORM\Id
  34.      * @ORM\Column(type="integer")
  35.      * @ORM\GeneratedValue(strategy="AUTO")
  36.      * @Groups({"pressroom", "auth-token","auth-user-list","group_user","client-list","mailling","evenement","suivi","organisation","coordonnees","parution", "contact","liste_parution","liste_organisation","liste_contact"})
  37.      */
  38.     private $id;
  39.     /**
  40.      * @ORM\Column(type="string", length=255, unique=true)
  41.      * @Assert\NotBlank()
  42.      * @Groups({"auth-token"})
  43.      */
  44.     private $username;
  45.     /**
  46.      * @Assert\Length(max=4096)
  47.      */
  48.     private $plainPassword;
  49.     /**
  50.      * @ORM\Column(name="password_mail",length=255, type="string")
  51.      */
  52.     private $passwordMail;
  53.     /**
  54.      * @ORM\Column(type="string", length=64)
  55.      */
  56.     private $password;
  57.     /**
  58.      * @ORM\Column(name="roles", type="array")
  59.      * @Groups({"auth-token"})
  60.      */
  61.     private $roles = array();
  62.     /**
  63.      * @ORM\ManyToOne(targetEntity="\App\Entity\User", fetch="EAGER",cascade={"all"})
  64.      * @var User $user
  65.      * @Groups({"auth-token","auth-user-list","group_user"})
  66.      * @Groups({"pressroom", "group_user","client-list","mailling", "evenement","suivi","organisation","parution", "contact","actualite","liste_parution","liste_organisation","liste_contact"})
  67.      */
  68.     private $user;
  69.     /**
  70.      * @ORM\Column(type="string", length=255,nullable=true)
  71.      * @Groups({"auth-token"})
  72.      */
  73.     private $oldLogin;
  74.     /**
  75.      * @ORM\Column(type="string", length=255,nullable=true)
  76.      * @Groups({"auth-token"})
  77.      */
  78.     private $oldPassword;
  79.     /**
  80.      * @ORM\OneToMany(targetEntity="App\Entity\AuthUserGroupeUser", mappedBy="user")
  81.      */
  82.     private $groupes;
  83.     /**
  84.      * @ORM\Column(name="actuel",type="boolean")
  85.      * @Groups({"auth-token"})
  86.      */
  87.     private $actuel;
  88.     /**
  89.      * @ORM\Column(name="fonction", type="string")
  90.      * @Assert\Choice({"Bo","Consultant","Rs","Direction","Admin", "Us", "Commercial"}, message="choisissez une fonction corect")
  91.      * @Groups({"auth-token","auth-user-list"})
  92.      */
  93.     private $fonction;
  94.     /**
  95.      * @ORM\Column(name="date_arrive",type="datetime",nullable=true)
  96.      * @Groups({"auth-token","auth-user-list"})
  97.      */
  98.     private $dateArrive;
  99.     /**
  100.      * @ORM\Column(name="tel_interne",type="string",length=255, nullable = true)
  101.      * @Groups({"auth-user-list","auth-token"})
  102.      */
  103.     private $telInterne;
  104.     /**
  105.      * @ORM\OneToMany(targetEntity="App\Entity\ClientRoleUser", mappedBy="authUser",fetch="EAGER")
  106.      * @Groups({"auth-token","auth-user-list"})
  107.      */
  108.     private $rolesUserClient;
  109.     /**
  110.      * @ORM\Column(name="adresse_envoi",type="string",length=255,nullable=true)
  111.      * @Groups({"auth-user-list"})
  112.      */
  113.     private $adresseEnvoi;
  114.     /**
  115.      * @ORM\ManyToMany(targetEntity="App\Entity\Evenement",mappedBy="participants")
  116.      */
  117.     private $evenements;
  118.     /**
  119.      * @ORM\Column (name="count_email_verifier_existant_adelete", type="integer",nullable=true)
  120.      */
  121.     private $countEmailVerifierExistantADelete;
  122.     /**
  123.      * @ORM\Column(name="u_systeme",type="boolean",nullable=true)
  124.      * @Groups({"auth-token"})
  125.      */
  126.     private $uSysteme;
  127.     /**
  128.      * @ORM\OneToMany(targetEntity=Suivi::class, mappedBy="suiviPar")
  129.      */
  130.     private $suivis;
  131.     public function __construct()
  132.     {
  133.         $this->rolesUserClient = new ArrayCollection();
  134.         $this->groupes = new ArrayCollection();
  135.         $this->evenements = new ArrayCollection();
  136.         $this->suivis = new ArrayCollection();
  137.     }
  138.     /**
  139.      * @return mixed
  140.      */
  141.     public function getFonction()
  142.     {
  143.         return $this->fonction;
  144.     }
  145.     /**
  146.      * @param mixed $fonction
  147.      */
  148.     public function setFonction($fonction): void
  149.     {
  150.         $this->fonction $fonction;
  151.     }
  152.     /**
  153.      * @return mixed
  154.      */
  155.     public function getOldLogin()
  156.     {
  157.         return $this->oldLogin;
  158.     }
  159.     /**
  160.      * @param mixed $oldLogin
  161.      */
  162.     public function setOldLogin($oldLogin): void
  163.     {
  164.         $this->oldLogin $oldLogin;
  165.     }
  166.     /**
  167.      * @return mixed
  168.      */
  169.     public function getOldPassword()
  170.     {
  171.         return $this->oldPassword;
  172.     }
  173.     /**
  174.      * @param mixed $oldPassword
  175.      */
  176.     public function setOldPassword($oldPassword): void
  177.     {
  178.         $this->oldPassword $oldPassword;
  179.     }
  180.     /**
  181.      * @return User
  182.      */
  183.     public function getUser(): User
  184.     {
  185.         return $this->user;
  186.     }
  187.     /**
  188.      * @param User $user
  189.      */
  190.     public function setUser(User $user): void
  191.     {
  192.         $this->user $user;
  193.     }
  194.     /**
  195.      * @return mixed
  196.      */
  197.     public function getId()
  198.     {
  199.         return $this->id;
  200.     }
  201.     /**
  202.      * @param mixed $id
  203.      */
  204.     public function setId($id)
  205.     {
  206.         $this->id $id;
  207.     }
  208.     /**
  209.      * @return mixed
  210.      */
  211.     public function getUsername()
  212.     {
  213.         return $this->username;
  214.     }
  215.     /**
  216.      * @param mixed $username
  217.      */
  218.     public function setUsername($username)
  219.     {
  220.         $this->username $username;
  221.     }
  222.     /**
  223.      * @return mixed
  224.      */
  225.     public function getPlainPassword()
  226.     {
  227.         return $this->plainPassword;
  228.     }
  229.     /**
  230.      * @param mixed $plainPassword
  231.      */
  232.     public function setPlainPassword($plainPassword)
  233.     {
  234.         $this->plainPassword $plainPassword;
  235.     }
  236.     /**
  237.      * @return mixed
  238.      */
  239.     public function getPassword()
  240.     {
  241.         return $this->password;
  242.     }
  243.     /**
  244.      * @param mixed $password
  245.      */
  246.     public function setPassword($password)
  247.     {
  248.         $this->password $password;
  249.     }
  250.     /**
  251.      * @param mixed $roles
  252.      */
  253.     public function setRoles($roles)
  254.     {
  255.         $this->roles $roles;
  256.     }
  257.     public function getSalt()
  258.     {
  259.         return null;
  260.     }
  261.     public function getRoles()
  262.     {
  263.         return $this->roles;
  264.     }
  265.     public function eraseCredentials()
  266.     {
  267.         $this->plainPassword null;
  268.     }
  269.     /**
  270.      * @return mixed
  271.      */
  272.     public function getActuel()
  273.     {
  274.         return $this->actuel;
  275.     }
  276.     /**
  277.      * @param mixed $actuel
  278.      */
  279.     public function setActuel($actuel): void
  280.     {
  281.         $this->actuel $actuel;
  282.     }
  283.     /**
  284.      * @return mixed
  285.      */
  286.     public function getDateArrive()
  287.     {
  288.         return $this->dateArrive;
  289.     }
  290.     /**
  291.      * @param mixed $dateArrive
  292.      */
  293.     public function setDateArrive($dateArrive): void
  294.     {
  295.         $this->dateArrive $dateArrive;
  296.     }
  297.     /**
  298.      * @return mixed
  299.      */
  300.     public function getTelInterne()
  301.     {
  302.         return $this->telInterne;
  303.     }
  304.     /**
  305.      * @param mixed $telInterne
  306.      */
  307.     public function setTelInterne($telInterne): void
  308.     {
  309.         $this->telInterne $telInterne;
  310.     }
  311.     /**
  312.      * Add rolesUserClient
  313.      *
  314.      * @param \App\Entity\ClientRoleUser $rolesUserClient
  315.      *
  316.      * @return AuthUser
  317.      */
  318.     public function addRolesUserClient(\App\Entity\ClientRoleUser $rolesUserClient)
  319.     {
  320.         $this->rolesUserClient[] = $rolesUserClient;
  321.         return $this;
  322.     }
  323.     /**
  324.      * Get rolesUserClient
  325.      *
  326.      */
  327.     public function getRolesUserClient()
  328.     {
  329.         return $this->rolesUserClient;
  330.     }
  331.     /**
  332.      * Set rolesUserClient
  333.      *
  334.      */
  335.     public function setRolesUserClient($roleUserClientNew)
  336.     {
  337.         $this->rolesUserClient $roleUserClientNew;
  338.         return $this->rolesUserClient;
  339.     }
  340.     /**
  341.      * Add groupes
  342.      *
  343.      * @param \App\Entity\GroupeUser $groupe
  344.      *
  345.      * @return AuthUser
  346.      */
  347.     public function addGroupe(\App\Entity\GroupeUser $groupe)
  348.     {
  349.         $this->groupes[] = $groupe;
  350.         return $this;
  351.     }
  352.     /**
  353.      * Remove groupes
  354.      *
  355.      * @param \App\Entity\GroupeUser $groupe
  356.      */
  357.     public function removeGroupe(\App\Entity\GroupeUser $groupe)
  358.     {
  359.         $this->groupes->removeElement($groupe);
  360.     }
  361.     /**
  362.      * @return mixed
  363.      */
  364.     public function getGroupes()
  365.     {
  366.         return $this->groupes;
  367.     }
  368.     /**
  369.      * @return mixed
  370.      */
  371.     public function getAdresseEnvoi()
  372.     {
  373.         return $this->adresseEnvoi;
  374.     }
  375.     /**
  376.      * @param mixed $adresseEnvoi
  377.      */
  378.     public function setAdresseEnvoi($adresseEnvoi): void
  379.     {
  380.         $this->adresseEnvoi $adresseEnvoi;
  381.     }
  382.     /**
  383.      * @return mixed
  384.      */
  385.     public function getPasswordMail()
  386.     {
  387.         return $this->passwordMail;
  388.     }
  389.     /**
  390.      * @param mixed $passwordMail
  391.      */
  392.     public function setPasswordMail($passwordMail): void
  393.     {
  394.         $this->passwordMail $passwordMail;
  395.     }
  396.     /**
  397.      * @return Collection|Evenement[]
  398.      */
  399.     public function getEvenements(): Collection
  400.     {
  401.         return $this->evenements;
  402.     }
  403.     public function addEvenement(Evenement $evenement): self
  404.     {
  405.         if (!$this->evenements->contains($evenement)) {
  406.             $this->evenements[] = $evenement;
  407.             $evenement->addParticipant($this);
  408.         }
  409.         return $this;
  410.     }
  411.     public function removeEvenement(Evenement $evenement): self
  412.     {
  413.         if ($this->evenements->contains($evenement)) {
  414.             $this->evenements->removeElement($evenement);
  415.             $evenement->removeParticipant($this);
  416.         }
  417.         return $this;
  418.     }
  419.     public function removeRolesUserClient(ClientRoleUser $rolesUserClient): self
  420.     {
  421.         if ($this->rolesUserClient->contains($rolesUserClient)) {
  422.             $this->rolesUserClient->removeElement($rolesUserClient);
  423.             // set the owning side to null (unless already changed)
  424.             if ($rolesUserClient->getAuthUser() === $this) {
  425.                 $rolesUserClient->setAuthUser(null);
  426.             }
  427.         }
  428.         return $this;
  429.     }
  430.     public function getCountEmailVerifierExistantADelete(): ?int
  431.     {
  432.         return $this->countEmailVerifierExistantADelete;
  433.     }
  434.     public function setCountEmailVerifierExistantADelete(int $countEmailVerifierExistantADelete): self
  435.     {
  436.         $this->countEmailVerifierExistantADelete $countEmailVerifierExistantADelete;
  437.         return $this;
  438.     }
  439.     /**
  440.      * @return mixed
  441.      */
  442.     public function getUSysteme()
  443.     {
  444.         return $this->uSysteme;
  445.     }
  446.     /**
  447.      * @param mixed $uSysteme
  448.      */
  449.     public function setUSysteme($uSysteme) : void
  450.     {
  451.         $this->uSysteme $uSysteme;
  452.     }
  453.     /**
  454.      * @return Collection|Suivi[]
  455.      */
  456.     public function getSuivis(): Collection
  457.     {
  458.         return $this->suivis;
  459.     }
  460.     public function addSuivi(Suivi $suivi): self
  461.     {
  462.         if (!$this->suivis->contains($suivi)) {
  463.             $this->suivis[] = $suivi;
  464.             //$suivi->setSuiviPar($this);
  465.         }
  466.         return $this;
  467.     }
  468.     public function removeSuivi(Suivi $suivi): self
  469.     {
  470.         if ($this->suivis->removeElement($suivi)) {
  471.             // set the owning side to null (unless already changed)
  472.             if ($suivi->getSuiviPar() === $this) {
  473.                 $suivi->setSuiviPar(null);
  474.             }
  475.         }
  476.         return $this;
  477.     }
  478. }