src/Entity/User.php line 13

  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. #[ORM\Entity(repositoryClassUserRepository::class)]
  10. class User implements UserInterfacePasswordAuthenticatedUserInterface
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length180uniquetrue)]
  17.     private ?string $email null;
  18.     
  19.     #[ORM\Column]
  20.     private array $roles = [];
  21.     /**
  22.      * @var string The hashed password
  23.      */
  24.     #[ORM\Column]
  25.     private ?string $password null;
  26.     #[ORM\Column(length50)]
  27.     private ?string $prenom null;
  28.     #[ORM\Column(length50)]
  29.     private ?string $nom null;
  30.     #[ORM\ManyToOne]
  31.     private ?VilleFrance $ville null;
  32.     #[ORM\Column(length50)]
  33.     private ?string $initiales null;
  34.     #[ORM\OneToMany(mappedBy'user'targetEntityCamion::class)]
  35.     private Collection $camions;
  36.     #[ORM\OneToMany(mappedBy'user'targetEntityCamionUser::class)]
  37.     private Collection $camionUsers;
  38.     #[ORM\ManyToOne]
  39.     private ?VilleFrance $villeAttache null;
  40.     #[ORM\OneToMany(mappedBy'user'targetEntityDocumentation::class)]
  41.     private Collection $documentations;
  42.     #[ORM\OneToMany(mappedBy'user'targetEntityCartePaiement::class)]
  43.     private Collection $cartePaiements;
  44.     #[ORM\Column(length10nullabletrue)]
  45.     private ?string $matricule null;
  46.     #[ORM\Column]
  47.     private ?int $actif null;
  48.     #[ORM\ManyToOne(inversedBy'users')]
  49.     private ?SystemeClient $systemeClient null;
  50.     #[ORM\OneToMany(mappedBy'user'targetEntityAbsence::class)]
  51.     private Collection $absences;
  52.     #[ORM\OneToMany(mappedBy'user'targetEntityPlanningReccurence::class)]
  53.     private Collection $planningReccurences;
  54.     #[ORM\Column]
  55.     private ?int $carteClefRendu null;
  56.     #[ORM\Column]
  57.     private ?int $rappelSms null;
  58.     #[ORM\Column(length255)]
  59.     private ?string $telephone null;
  60.     #[ORM\OneToMany(mappedBy'user'targetEntityInfoChauffeur::class)]
  61.     private Collection $infoChauffeurs;
  62.     #[ORM\OneToMany(mappedBy'user'targetEntityInfoChauffeurDate::class)]
  63.     private Collection $infoChauffeurDates;
  64.     #[ORM\OneToMany(mappedBy'userUpdate'targetEntityPlanningUpdateDateTime::class)]
  65.     private Collection $planningUpdateDateTimes;
  66.     #[ORM\OneToMany(mappedBy'user'targetEntityHoraireExploit::class)]
  67.     private Collection $no;
  68.     #[ORM\Column(length20)]
  69.     private ?string $telephonePro null;
  70.     #[ORM\Column(length6)]
  71.     private ?string $codePin null;
  72.     #[ORM\Column]
  73.     private ?int $idAddSecure null;
  74.     //const MDPINFO = "8RLHJCl32uDf";
  75.     const MDPINFO "Cont@ctSolu555$";
  76.     const USERINFO "contact@solubac.fr";
  77.     const HOSTINFO "smtp.office365.com";
  78.     //const HOSTINFO = "mail.infomaniak.ch";
  79.     const PORTINFO 587;
  80.     const APIKEYGOOGLE 'AIzaSyCyY3op2G-PX5ZD-UDY58jPKTJic1_y-rI';
  81.     //const PORTINFO = 465;
  82.     /**
  83.      * User constructor.
  84.      */
  85.     public function __construct()
  86.     {
  87.         $this->camions = new ArrayCollection();
  88.         $this->camionUsers = new ArrayCollection();
  89.         $this->documentations = new ArrayCollection();
  90.         $this->cartePaiements = new ArrayCollection();
  91.         $this->absences = new ArrayCollection();
  92.         $this->planningReccurences = new ArrayCollection();
  93.         $this->infoChauffeurs = new ArrayCollection();
  94.         $this->infoChauffeurDates = new ArrayCollection();
  95.         $this->planningUpdateDateTimes = new ArrayCollection();
  96.         $this->no = new ArrayCollection();
  97.         $this->documentChauffeurHistos = new ArrayCollection();
  98.         $this->date = new ArrayCollection();
  99.     }
  100.     public function getId(): ?int
  101.     {
  102.         return $this->id;
  103.     }
  104.     public function getEmail(): ?string
  105.     {
  106.         return $this->email;
  107.     }
  108.     public function setEmail(string $email): self
  109.     {
  110.         $this->email $email;
  111.         return $this;
  112.     }
  113.     /**
  114.      * A visual identifier that represents this user.
  115.      *
  116.      * @see UserInterface
  117.      */
  118.     public function getUserIdentifier(): 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.     /**
  133.      * @see UserInterface
  134.      */
  135.     public function getRoleAdmin()
  136.     {
  137.         $admin false;
  138.         foreach($this->roles as $role)
  139.         {
  140.             if($role=="ROLE_ADMIN")
  141.             {
  142.                 $admin true;
  143.             }
  144.         }
  145.         return $admin;
  146.     }
  147.     /**
  148.      * @see UserInterface
  149.      */
  150.     public function getRoleNotif()
  151.     {
  152.         $admin false;
  153.         foreach($this->roles as $role)
  154.         {
  155.             if($role=="ROLE_NOTIF")
  156.             {
  157.                 $admin true;
  158.             }
  159.         }
  160.         return $admin;
  161.     }
  162.     /**
  163.      * @see UserInterface
  164.      */
  165.     public function getRoleChauffeur()
  166.     {
  167.         $admin false;
  168.         foreach($this->roles as $role)
  169.         {
  170.             if($role=="ROLE_CHAUFFEUR")
  171.             {
  172.                 $admin true;
  173.             }
  174.         }
  175.         return $admin;
  176.     }
  177.     /**
  178.      * @see UserInterface
  179.      */
  180.     public function getRoleAnal()
  181.     {
  182.         $admin false;
  183.         foreach($this->roles as $role)
  184.         {
  185.             if($role=="ROLE_ANAL")
  186.             {
  187.                 $admin true;
  188.             }
  189.         }
  190.         return $admin;
  191.     }
  192.     /**
  193.      * @see UserInterface
  194.      */
  195.     public function getRoleTech()
  196.     {
  197.         $admin false;
  198.         foreach($this->roles as $role)
  199.         {
  200.             if($role=="ROLE_TECH")
  201.             {
  202.                 $admin true;
  203.             }
  204.         }
  205.         return $admin;
  206.     }
  207.     /**
  208.      * @see UserInterface
  209.      */
  210.     public function getRoleExpl()
  211.     {
  212.         $admin false;
  213.         foreach($this->roles as $role)
  214.         {
  215.             if($role=="ROLE_EXPL")
  216.             {
  217.                 $admin true;
  218.             }
  219.         }
  220.         return $admin;
  221.     }
  222.     public function setRoles(array $roles): self
  223.     {
  224.         $this->roles $roles;
  225.         return $this;
  226.     }
  227.     /**
  228.      * @see PasswordAuthenticatedUserInterface
  229.      */
  230.     public function getPassword(): string
  231.     {
  232.         return $this->password;
  233.     }
  234.     public function setPassword(string $password): self
  235.     {
  236.         $this->password $password;
  237.         return $this;
  238.     }
  239.     /**
  240.      * @see UserInterface
  241.      */
  242.     public function eraseCredentials()
  243.     {
  244.         // If you store any temporary, sensitive data on the user, clear it here
  245.         // $this->plainPassword = null;
  246.     }
  247.     public function getPrenom(): ?string
  248.     {
  249.         return $this->prenom;
  250.     }
  251.     public function setPrenom(string $prenom): self
  252.     {
  253.         $this->prenom $prenom;
  254.         return $this;
  255.     }
  256.     public function getNom(): ?string
  257.     {
  258.         return $this->nom;
  259.     }
  260.     public function setNom(string $nom): self
  261.     {
  262.         $this->nom $nom;
  263.         return $this;
  264.     }
  265.     public function getVille(): ?VilleFrance
  266.     {
  267.         return $this->ville;
  268.     }
  269.     public function setVille(VilleFrance $ville): self
  270.     {
  271.         $this->ville $ville;
  272.         return $this;
  273.     }
  274.     /**
  275.      * @return Collection<int, Camion>
  276.      */
  277.     public function getCamions(): Collection
  278.     {
  279.         return $this->camions;
  280.     }
  281.     public function addCamion(Camion $camion): self
  282.     {
  283.         if (!$this->camions->contains($camion)) {
  284.             $this->camions->add($camion);
  285.             $camion->setUser($this);
  286.         }
  287.         return $this;
  288.     }
  289.     public function removeCamion(Camion $camion): self
  290.     {
  291.         if ($this->camions->removeElement($camion)) {
  292.             // set the owning side to null (unless already changed)
  293.             if ($camion->getUser() === $this) {
  294.                 $camion->setUser(null);
  295.             }
  296.         }
  297.         return $this;
  298.     }
  299.     /**
  300.      * @return Collection<int, CamionUser>
  301.      */
  302.     public function getCamionUsers(): Collection
  303.     {
  304.         return $this->camionUsers;
  305.     }
  306.     public function addCamionUser(CamionUser $camionUser): self
  307.     {
  308.         if (!$this->camionUsers->contains($camionUser)) {
  309.             $this->camionUsers->add($camionUser);
  310.             $camionUser->setUser($this);
  311.         }
  312.         return $this;
  313.     }
  314.     public function removeCamionUser(CamionUser $camionUser): self
  315.     {
  316.         if ($this->camionUsers->removeElement($camionUser)) {
  317.             // set the owning side to null (unless already changed)
  318.             if ($camionUser->getUser() === $this) {
  319.                 $camionUser->setUser(null);
  320.             }
  321.         }
  322.         return $this;
  323.     }
  324.     public function __toString()
  325.     {
  326.         return $this->getPrenom().' '.$this->getNom();
  327.     }
  328.     public function getInitiales(): ?string
  329.     {
  330.         return $this->initiales;
  331.     }
  332.     public function setInitiales(string $initiales): self
  333.     {
  334.         $this->initiales $initiales;
  335.         return $this;
  336.     }
  337.     public function getVilleAttache(): ?VilleFrance
  338.     {
  339.         return $this->villeAttache;
  340.     }
  341.     public function setVilleAttache(VilleFrance $villeAttache): self
  342.     {
  343.         $this->villeAttache $villeAttache;
  344.         return $this;
  345.     }
  346.     /**
  347.      * @return Collection<int, Documentation>
  348.      */
  349.     public function getDocumentations(): Collection
  350.     {
  351.         return $this->documentations;
  352.     }
  353.     public function addDocumentation(Documentation $documentation): self
  354.     {
  355.         if (!$this->documentations->contains($documentation)) {
  356.             $this->documentations->add($documentation);
  357.             $documentation->setUser($this);
  358.         }
  359.         return $this;
  360.     }
  361.     public function removeDocumentation(Documentation $documentation): self
  362.     {
  363.         if ($this->documentations->removeElement($documentation)) {
  364.             // set the owning side to null (unless already changed)
  365.             if ($documentation->getUser() === $this) {
  366.                 $documentation->setUser(null);
  367.             }
  368.         }
  369.         return $this;
  370.     }
  371.     public function getMatricule(): ?string
  372.     {
  373.         return $this->matricule;
  374.     }
  375.     public function setMatricule(?string $matricule): self
  376.     {
  377.         $this->matricule $matricule;
  378.         return $this;
  379.     }
  380.     public function getActif(): ?int
  381.     {
  382.         return $this->actif;
  383.     }
  384.     public function setActif(int $actif): self
  385.     {
  386.         $this->actif $actif;
  387.         return $this;
  388.     }
  389.     public function getSystemeClient(): ?SystemeClient
  390.     {
  391.         return $this->systemeClient;
  392.     }
  393.     public function setSystemeClient(?SystemeClient $systemeClient): self
  394.     {
  395.         $this->systemeClient $systemeClient;
  396.         return $this;
  397.     }
  398.     /**
  399.      * @return Collection<int, Absence>
  400.      */
  401.     public function getAbsences(): Collection
  402.     {
  403.         return $this->absences;
  404.     }
  405.     public function addAbsence(Absence $absence): self
  406.     {
  407.         if (!$this->absences->contains($absence)) {
  408.             $this->absences->add($absence);
  409.             $absence->setUser($this);
  410.         }
  411.         return $this;
  412.     }
  413.     public function removeAbsence(Absence $absence): self
  414.     {
  415.         if ($this->absences->removeElement($absence)) {
  416.             // set the owning side to null (unless already changed)
  417.             if ($absence->getUser() === $this) {
  418.                 $absence->setUser(null);
  419.             }
  420.         }
  421.         return $this;
  422.     }
  423.     /**
  424.      * @return Collection<int, PlanningReccurence>
  425.      */
  426.     public function getPlanningReccurences(): Collection
  427.     {
  428.         return $this->planningReccurences;
  429.     }
  430.     public function addPlanningReccurence(PlanningReccurence $planningReccurence): self
  431.     {
  432.         if (!$this->planningReccurences->contains($planningReccurence)) {
  433.             $this->planningReccurences->add($planningReccurence);
  434.             $planningReccurence->setUser($this);
  435.         }
  436.         return $this;
  437.     }
  438.     public function removePlanningReccurence(PlanningReccurence $planningReccurence): self
  439.     {
  440.         if ($this->planningReccurences->removeElement($planningReccurence)) {
  441.             // set the owning side to null (unless already changed)
  442.             if ($planningReccurence->getUser() === $this) {
  443.                 $planningReccurence->setUser(null);
  444.             }
  445.         }
  446.         return $this;
  447.     }
  448.     public function getCarteClefRendu(): ?int
  449.     {
  450.         return $this->carteClefRendu;
  451.     }
  452.     public function setCarteClefRendu(int $carteClefRendu): self
  453.     {
  454.         $this->carteClefRendu $carteClefRendu;
  455.         return $this;
  456.     }
  457.     public function getRappelSms(): ?int
  458.     {
  459.         return $this->rappelSms;
  460.     }
  461.     public function setRappelSms(int $rappelSms): self
  462.     {
  463.         $this->rappelSms $rappelSms;
  464.         return $this;
  465.     }
  466.     public function getTelephone(): ?string
  467.     {
  468.         return $this->telephone;
  469.     }
  470.     public function setTelephone(string $telephone): self
  471.     {
  472.         $this->telephone $telephone;
  473.         return $this;
  474.     }
  475.     /**
  476.      * @return Collection<int, InfoChauffeur>
  477.      */
  478.     public function getInfoChauffeurs(): Collection
  479.     {
  480.         return $this->infoChauffeurs;
  481.     }
  482.     public function addInfoChauffeur(InfoChauffeur $infoChauffeur): self
  483.     {
  484.         if (!$this->infoChauffeurs->contains($infoChauffeur)) {
  485.             $this->infoChauffeurs->add($infoChauffeur);
  486.             $infoChauffeur->setUser($this);
  487.         }
  488.         return $this;
  489.     }
  490.     public function removeInfoChauffeur(InfoChauffeur $infoChauffeur): self
  491.     {
  492.         if ($this->infoChauffeurs->removeElement($infoChauffeur)) {
  493.             // set the owning side to null (unless already changed)
  494.             if ($infoChauffeur->getUser() === $this) {
  495.                 $infoChauffeur->setUser(null);
  496.             }
  497.         }
  498.         return $this;
  499.     }
  500.     public function getInfoChauffeur()
  501.     {
  502.         $return null;
  503.         if(!empty($this->infoChauffeurs))
  504.         {
  505.             foreach($this->infoChauffeurs as $infoChauffeur)
  506.             {
  507.                 $return $infoChauffeur;
  508.             }
  509.         }
  510.         return $return;
  511.     }
  512.     /**
  513.      * @return Collection<int, InfoChauffeurDate>
  514.      */
  515.     public function getInfoChauffeurDates(): Collection
  516.     {
  517.         return $this->infoChauffeurDates;
  518.     }
  519.     public function addInfoChauffeurDate(InfoChauffeurDate $infoChauffeurDate): self
  520.     {
  521.         if (!$this->infoChauffeurDates->contains($infoChauffeurDate)) {
  522.             $this->infoChauffeurDates->add($infoChauffeurDate);
  523.             $infoChauffeurDate->setUser($this);
  524.         }
  525.         return $this;
  526.     }
  527.     public function removeInfoChauffeurDate(InfoChauffeurDate $infoChauffeurDate): self
  528.     {
  529.         if ($this->infoChauffeurDates->removeElement($infoChauffeurDate)) {
  530.             // set the owning side to null (unless already changed)
  531.             if ($infoChauffeurDate->getUser() === $this) {
  532.                 $infoChauffeurDate->setUser(null);
  533.             }
  534.         }
  535.         return $this;
  536.     }
  537.     /**
  538.      * @return Collection<int, PlanningUpdateDateTime>
  539.      */
  540.     public function getPlanningUpdateDateTimes(): Collection
  541.     {
  542.         return $this->planningUpdateDateTimes;
  543.     }
  544.     public function addPlanningUpdateDateTime(PlanningUpdateDateTime $planningUpdateDateTime): static
  545.     {
  546.         if (!$this->planningUpdateDateTimes->contains($planningUpdateDateTime)) {
  547.             $this->planningUpdateDateTimes->add($planningUpdateDateTime);
  548.             $planningUpdateDateTime->setUserUpdate($this);
  549.         }
  550.         return $this;
  551.     }
  552.     public function removePlanningUpdateDateTime(PlanningUpdateDateTime $planningUpdateDateTime): static
  553.     {
  554.         if ($this->planningUpdateDateTimes->removeElement($planningUpdateDateTime)) {
  555.             // set the owning side to null (unless already changed)
  556.             if ($planningUpdateDateTime->getUserUpdate() === $this) {
  557.                 $planningUpdateDateTime->setUserUpdate(null);
  558.             }
  559.         }
  560.         return $this;
  561.     }
  562.     /**
  563.      * @return Collection<int, HoraireExploit>
  564.      */
  565.     public function getNo(): Collection
  566.     {
  567.         return $this->no;
  568.     }
  569.     public function addNo(HoraireExploit $no): static
  570.     {
  571.         if (!$this->no->contains($no)) {
  572.             $this->no->add($no);
  573.             $no->setUser($this);
  574.         }
  575.         return $this;
  576.     }
  577.     public function removeNo(HoraireExploit $no): static
  578.     {
  579.         if ($this->no->removeElement($no)) {
  580.             // set the owning side to null (unless already changed)
  581.             if ($no->getUser() === $this) {
  582.                 $no->setUser(null);
  583.             }
  584.         }
  585.         return $this;
  586.     }
  587.     public function getTelephonePro(): ?string
  588.     {
  589.         return $this->telephonePro;
  590.     }
  591.     public function setTelephonePro(string $telephonePro): static
  592.     {
  593.         $this->telephonePro $telephonePro;
  594.         return $this;
  595.     }
  596.     public function getCodePin(): ?string
  597.     {
  598.         return $this->codePin;
  599.     }
  600.     public function setCodePin(string $codePin): static
  601.     {
  602.         $this->codePin $codePin;
  603.         return $this;
  604.     }
  605.     public function getIdAddSecure(): ?int
  606.     {
  607.         return $this->idAddSecure;
  608.     }
  609.     public function setIdAddSecure(int $idAddSecure): static
  610.     {
  611.         $this->idAddSecure $idAddSecure;
  612.         return $this;
  613.     }
  614. }