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

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