src/Entity/Gestiform/Users/Employe.php line 16

  1. <?php
  2. namespace App\Entity\Gestiform\Users;
  3. use App\Entity\Common\Upload;
  4. use App\Entity\Common\HistoriqueEmail;
  5. use App\Entity\Gestiform\Formations\Dossier\Dossier;
  6. use App\Entity\Gestiform\Formations\Dossier\HistoriqueDossier;
  7. use App\Entity\Gestiform\Formations\Dossier\PersonalInformations;
  8. use App\Repository\Gestiform\Users\EmployeRepository;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\ORM\Mapping as ORM;
  12. #[ORM\Entity(repositoryClassEmployeRepository::class)]
  13. class Employe extends User
  14. {
  15.     #[ORM\JoinColumn(nullabletrue)]
  16.     #[ORM\ManyToOne(targetEntityPersonalInformations::class, cascade: ['all'])]
  17.     private ?PersonalInformations $personalInformations null;
  18.     #[ORM\OneToMany(mappedBy'reorienter'targetEntityDossier::class)]
  19.     private Collection $dossierReorienters;
  20.     #[ORM\OneToMany(mappedBy'referentPedagogique'targetEntityDossier::class)]
  21.     private Collection $referentPedagogiques;
  22.     #[ORM\OneToMany(mappedBy'referentCommercial'targetEntityDossier::class)]
  23.     private Collection $referentCommercials;
  24.     #[ORM\OneToMany(mappedBy'referentCoach'targetEntityDossier::class)]
  25.     private Collection $referentCoachs;
  26.     #[ORM\OneToMany(mappedBy'referentAdministratif'targetEntityDossier::class)]
  27.     private Collection $referentAdministratifs;
  28.     #[ORM\OneToMany(mappedBy'employe'targetEntityHistoriqueEmail::class, cascade: ['persist'])]
  29.     private Collection $historiqueEmails;
  30.     #[ORM\JoinColumn(nullabletrue)]
  31.     #[ORM\OneToOne(targetEntityUpload::class, cascade: ['persist''remove'])]
  32.     private ?Upload $rgpdDocument null;
  33.     
  34.     #[ORM\Column(type'datetime_immutable'nullabletrue)]
  35.     private ?\DateTimeImmutable $rgpdSignedAt null;
  36.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  37.     #[ORM\ManyToOne(targetEntityEmploye::class, fetch'EAGER')]
  38.     private ?Employe $responsableHierarchique null;
  39.     public function __construct()
  40.     {
  41.         $this->dossierReorienters = new ArrayCollection();
  42.         $this->referentPedagogiques = new ArrayCollection();
  43.         $this->referentCommercials = new ArrayCollection();
  44.         $this->referentCoachs = new ArrayCollection();
  45.         $this->referentAdministratifs = new ArrayCollection();
  46.         $this->historiqueEmails = new ArrayCollection();
  47.     }
  48.     public function getPersonalInformations(): ?PersonalInformations
  49.     {
  50.         return $this->personalInformations;
  51.     }
  52.     public function setPersonalInformations(?PersonalInformations $personalInformations): self
  53.     {
  54.         $this->personalInformations $personalInformations;
  55.         return $this;
  56.     }
  57.     /**
  58.      * @return Collection<int, HistoriqueDossier>
  59.      */
  60.     public function getDossierReorienters(): Collection
  61.     {
  62.         return $this->dossierReorienters;
  63.     }
  64.     public function addDossierReorienter(Dossier $dossier): self
  65.     {
  66.         if (!$this->dossierReorienters->contains($dossier)) {
  67.             $this->dossierReorienters->add($dossier);
  68.             $dossier->setReorienter($this);
  69.         }
  70.         return $this;
  71.     }
  72.     public function removeDossierReorienter(Dossier $dossier): self
  73.     {
  74.         // set the owning side to null (unless already changed)
  75.         if ($this->dossierReorienters->removeElement($dossier) && $dossier->getReorienter() === $this) {
  76.             $dossier->setReorienter(null);
  77.         }
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection<int, Dossier>
  82.      */
  83.     public function getReferentPedagogiques(): Collection
  84.     {
  85.         return $this->referentPedagogiques;
  86.     }
  87.     public function addReferentPedagogique(Dossier $referentPedagogique): self
  88.     {
  89.         if (!$this->referentPedagogiques->contains($referentPedagogique)) {
  90.             $this->referentPedagogiques->add($referentPedagogique);
  91.             $referentPedagogique->setReferentPedagogique($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeReferentPedagogique(Dossier $referentPedagogique): self
  96.     {
  97.         // set the owning side to null (unless already changed)
  98.         if ($this->referentPedagogiques->removeElement($referentPedagogique) && $referentPedagogique->getReferentPedagogique() === $this) {
  99.             $referentPedagogique->setReferentPedagogique(null);
  100.         }
  101.         return $this;
  102.     }
  103.     /**
  104.      * @return Collection<int, Dossier>
  105.      */
  106.     public function getReferentCommercials(): Collection
  107.     {
  108.         return $this->referentCommercials;
  109.     }
  110.     public function addReferentCommercial(Dossier $referentCommercial): self
  111.     {
  112.         if (!$this->referentCommercials->contains($referentCommercial)) {
  113.             $this->referentCommercials->add($referentCommercial);
  114.             $referentCommercial->setReferentCommercial($this);
  115.         }
  116.         return $this;
  117.     }
  118.     public function removeReferentCommercial(Dossier $referentCommercial): self
  119.     {
  120.         // set the owning side to null (unless already changed)
  121.         if ($this->referentCommercials->removeElement($referentCommercial) && $referentCommercial->getReferentCommercial() === $this) {
  122.             $referentCommercial->setReferentCommercial(null);
  123.         }
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Collection<int, Dossier>
  128.      */
  129.     public function getReferentCoachs(): Collection
  130.     {
  131.         return $this->referentCoachs;
  132.     }
  133.     public function addReferentCoach(Dossier $referentCoach): self
  134.     {
  135.         if (!$this->referentCoachs->contains($referentCoach)) {
  136.             $this->referentCoachs->add($referentCoach);
  137.             $referentCoach->setReferentCoach($this);
  138.         }
  139.         return $this;
  140.     }
  141.     public function removeReferentCoach(Dossier $referentCoach): self
  142.     {
  143.         // set the owning side to null (unless already changed)
  144.         if ($this->referentCoachs->removeElement($referentCoach) && $referentCoach->getReferentCoach() === $this) {
  145.             $referentCoach->setReferentCoach(null);
  146.         }
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection<int, Dossier>
  151.      */
  152.     public function getReferentAdministratifs(): Collection
  153.     {
  154.         return $this->referentAdministratifs;
  155.     }
  156.     public function addReferentAdministratif(Dossier $referentAdministratif): self
  157.     {
  158.         if (!$this->referentAdministratifs->contains($referentAdministratif)) {
  159.             $this->referentAdministratifs->add($referentAdministratif);
  160.             $referentAdministratif->setReferentAdministratif($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeReferentAdministratif(Dossier $referentAdministratif): self
  165.     {
  166.         // set the owning side to null (unless already changed)
  167.         if ($this->referentAdministratifs->removeElement($referentAdministratif) && $referentAdministratif->getReferentAdministratif() === $this) {
  168.             $referentAdministratif->setReferentAdministratif(null);
  169.         }
  170.         return $this;
  171.     }
  172.     
  173.     /**
  174.      * Convertit l'objet en chaîne de caractères
  175.      * 
  176.      * @return string
  177.      */
  178.     public function __toString(): string
  179.     {
  180.         if ($this->getPersonalInformations() && $this->getPersonalInformations()->getNom()) {
  181.             return $this->getPersonalInformations()->getNom() . ' ' $this->getPersonalInformations()->getPrenom();
  182.         }
  183.         return $this->getUsername() ?: 'Employé sans nom';
  184.     }
  185.     /**
  186.      * @return Collection<int, HistoriqueEmail>
  187.      */
  188.     public function getHistoriqueEmails(): Collection
  189.     {
  190.         return $this->historiqueEmails;
  191.     }
  192.     public function addHistoriqueEmail(HistoriqueEmail $historiqueEmail): static
  193.     {
  194.         if (!$this->historiqueEmails->contains($historiqueEmail)) {
  195.             $this->historiqueEmails->add($historiqueEmail);
  196.             $historiqueEmail->setEmploye($this);
  197.         }
  198.         return $this;
  199.     }
  200.     public function removeHistoriqueEmail(HistoriqueEmail $historiqueEmail): self
  201.     {
  202.         if ($this->historiqueEmails->removeElement($historiqueEmail)) {
  203.             // set the owning side to null (unless already changed)
  204.             if ($historiqueEmail->getEmploye() === $this) {
  205.                 $historiqueEmail->setEmploye(null);
  206.             }
  207.         }
  208.         return $this;
  209.     }
  210.     public function getRgpdDocument(): ?Upload
  211.     {
  212.         return $this->rgpdDocument;
  213.     }
  214.     public function setRgpdDocument(?Upload $rgpdDocument): self
  215.     {
  216.         $this->rgpdDocument $rgpdDocument;
  217.         return $this;
  218.     }
  219.     public function getRgpdSignedAt(): ?\DateTimeImmutable
  220.     {
  221.         return $this->rgpdSignedAt;
  222.     }
  223.     public function setRgpdSignedAt(?\DateTimeImmutable $rgpdSignedAt): self
  224.     {
  225.         $this->rgpdSignedAt $rgpdSignedAt;
  226.         return $this;
  227.     }
  228.     public function getResponsableHierarchique(): ?Employe
  229.     {
  230.         return $this->responsableHierarchique;
  231.     }
  232.     public function setResponsableHierarchique(?Employe $responsableHierarchique): self
  233.     {
  234.         $this->responsableHierarchique $responsableHierarchique;
  235.         return $this;
  236.     }
  237. }