src/Entity/Gestiform/Users/Formateur.php line 25

  1. <?php
  2. namespace App\Entity\Gestiform\Users;
  3. use DateTime;
  4. use JsonException;
  5. use App\Entity\Common\Adresse;
  6. use App\Entity\Common\Upload;
  7. use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;
  8. use App\Entity\Gestiform\Formations\Catalogue\Parcours\Parcours;
  9. use App\Entity\Gestiform\Formations\Dossier\HistoriqueComment;
  10. use App\Entity\Gestiform\Formations\Entreprise\Contrat;
  11. use App\Entity\Gestiform\Formations\Entreprise\Entreprise;
  12. use App\Entity\Gestiform\Formations\Entreprise\FormateurEntreprise;
  13. use App\Entity\Gestiform\Formations\Formateur\FormateurModule;
  14. use App\Entity\Gestiform\Formations\Session\FormateurEvent;
  15. use App\Entity\Gestiform\Formations\Session\Planning\ApprenantLivrable;
  16. use App\Entity\Gestiform\Formations\Session\Planning\LignePrestation;
  17. use App\Repository\Gestiform\Users\FormateurRepository;
  18. use Doctrine\Common\Collections\ArrayCollection;
  19. use Doctrine\Common\Collections\Collection;
  20. use Doctrine\ORM\Mapping as ORM;
  21. #[ORM\Entity(repositoryClassFormateurRepository::class)]
  22. class Formateur extends Personne
  23. {
  24.     #[ORM\Column(type'string'length255nullabletrue)]
  25.     private ?string $prefecture null;
  26.     #[ORM\Column(type'string'length255nullabletrue)]
  27.     private ?string $numeroActivite null;
  28.     #[ORM\Column(type'string'length255nullabletrue)]
  29.     private ?string $numeroActivite2 null;
  30.     public function getNumeroActivite2(): ?string
  31.     {
  32.         return $this->numeroActivite2;
  33.     }
  34.     public function setNumeroActivite2(?string $numeroActivite2): Formateur
  35.     {
  36.         $this->numeroActivite2 $numeroActivite2;
  37.         return $this;
  38.     }
  39.     #[ORM\Column(type'string'nullabletrue)]
  40.     private ?string $listeCompetences null;
  41.     #[ORM\Column(type'datetime'nullabletrue)]
  42.     private ?DateTime $debutHabilitation null;
  43.     #[ORM\Column(type'datetime'nullabletrue)]
  44.     private ?DateTime $finHabilitation null;
  45.     #[ORM\Column(type'boolean'nullabletrue)]
  46.     private ?bool $juryUniquement null;
  47.     #[ORM\JoinColumn(nullabletrue)]
  48.     #[ORM\ManyToOne(targetEntityMasterlistelg::class)]
  49.     private ?Masterlistelg $statut null;
  50.     #[ORM\OneToMany(targetEntityFormateurModule::class, mappedBy'formateur'cascade: ['persist'])]
  51.     private Collection $formateurModules;
  52.     #[ORM\OneToMany(targetEntityParcours::class, mappedBy'formateur'cascade: ['persist'])]
  53.     private Collection $parcoursRNCP;
  54.     #[ORM\OneToMany(targetEntityFormateurEntreprise::class, mappedBy'formateur'cascade: ['persist'])]
  55.     private Collection $formateurEntreprises;
  56.     #[ORM\ManyToMany(targetEntityContrat::class, mappedBy'formateurs'cascade: ['persist'])]
  57.     private Collection $contrats;
  58.     #[ORM\ManyToMany(targetEntityLignePrestation::class, mappedBy'formateurs'cascade: ['all'])]
  59.     private Collection $lignePrestations;
  60.     #[ORM\OneToMany(targetEntityFormateurEvent::class, mappedBy'formateur'cascade: ['all'])]
  61.     private Collection $formateurEvents;
  62.     #[ORM\Column(type'text'nullabletrue)]
  63.     private ?string $missionProposee null;
  64.     #[ORM\OneToMany(targetEntityApprenantLivrable::class, mappedBy'formateur'cascade: ['persist'])]
  65.     private Collection $apprenantLivrables;
  66.     #[ORM\OneToMany(targetEntityHistoriqueComment::class, mappedBy'formateur'cascade: ['all'])]
  67.     private Collection $historiqueComments;
  68.     public function __construct()
  69.     {
  70.         parent::__construct();
  71.         $this->formateurModules = new ArrayCollection();
  72.         $this->formateurEntreprises = new ArrayCollection();
  73.         $this->formateurEvents = new ArrayCollection();
  74.         $this->contrats = new ArrayCollection();
  75.         $this->lignePrestations = new ArrayCollection();
  76.         $this->apprenantLivrables = new ArrayCollection();
  77.         $this->historiqueComments = new ArrayCollection();
  78.         $this->parcoursRNCP = new ArrayCollection();
  79.     }
  80.     public function getJuryUniquement(): ?bool
  81.     {
  82.         return $this->juryUniquement;
  83.     }
  84.     public function setJuryUniquement(?bool $juryUniquement): self
  85.     {
  86.         $this->juryUniquement $juryUniquement;
  87.         return $this;
  88.     }
  89.     public function getListeCompetences(): ?string
  90.     {
  91.         return $this->listeCompetences;
  92.     }
  93.     public function setListeCompetences(?string $listeCompetences): self
  94.     {
  95.         $this->listeCompetences $listeCompetences;
  96.         return $this;
  97.     }
  98.     public function getStatut(): ?Masterlistelg
  99.     {
  100.         return $this->statut;
  101.     }
  102.     public function setStatut(?Masterlistelg $statut): self
  103.     {
  104.         $this->statut $statut;
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection<int, FormateurModule>
  109.      */
  110.     public function getFormateurModules(): Collection
  111.     {
  112.         return $this->formateurModules;
  113.     }
  114.     public function addFormateurModule(FormateurModule $formateurModule): self
  115.     {
  116.         if (!$this->formateurModules->contains($formateurModule)) {
  117.             $this->formateurModules->add($formateurModule);
  118.             $formateurModule->setFormateur($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeFormateurModule(FormateurModule $formateurModule): self
  123.     {
  124.         // set the owning side to null (unless already changed)
  125.         if ($this->formateurModules->removeElement($formateurModule) && $formateurModule->getFormateur() === $this) {
  126.             $formateurModule->setFormateur(null);
  127.         }
  128.         return $this;
  129.     }
  130.     /**
  131.      * @return Collection<int, FormateurEntreprise>
  132.      */
  133.     public function getFormateurEntreprises(): Collection
  134.     {
  135.         return $this->formateurEntreprises;
  136.     }
  137.     public function addFormateurEntreprise(FormateurEntreprise $formateurEntreprise): self
  138.     {
  139.         if (!$this->formateurEntreprises->contains($formateurEntreprise)) {
  140.             $this->formateurEntreprises->add($formateurEntreprise);
  141.             $formateurEntreprise->setFormateur($this);
  142.         }
  143.         return $this;
  144.     }
  145.     public function removeFormateurEntreprise(FormateurEntreprise $formateurEntreprise): self
  146.     {
  147.         // set the owning side to null (unless already changed)
  148.         if ($this->formateurEntreprises->removeElement($formateurEntreprise) && $formateurEntreprise->getFormateur() === $this) {
  149.             $formateurEntreprise->setFormateur(null);
  150.         }
  151.         return $this;
  152.     }
  153.     public function getEntreprise(): ?Entreprise
  154.     {
  155.         $formateurEntreprises $this->getFormateurEntreprises();
  156.         if ($formateurEntreprises->isEmpty()) {
  157.             return null;
  158.         }
  159.         $firstRelation $formateurEntreprises->first();
  160.         return $firstRelation $firstRelation->getEntreprise() : null;
  161.     }
  162.     public function getPrefecture(): ?string
  163.     {
  164.         return $this->prefecture;
  165.     }
  166.     public function setPrefecture(?string $prefecture): self
  167.     {
  168.         $this->prefecture $prefecture;
  169.         return $this;
  170.     }
  171.     public function getNumeroActivite(): ?string
  172.     {
  173.         return $this->numeroActivite;
  174.     }
  175.     public function setNumeroActivite(?string $numeroActivite): self
  176.     {
  177.         $this->numeroActivite $numeroActivite;
  178.         return $this;
  179.     }
  180.     /**
  181.      * @return Collection<int, FormateurEvent>
  182.      */
  183.     public function getFormateurEvents(): Collection
  184.     {
  185.         return $this->formateurEvents;
  186.     }
  187.     public function addFormateurEvent(FormateurEvent $formateurEvent): self
  188.     {
  189.         if (!$this->formateurEvents->contains($formateurEvent)) {
  190.             $this->formateurEvents->add($formateurEvent);
  191.             $formateurEvent->setFormateur($this);
  192.         }
  193.         return $this;
  194.     }
  195.     public function removeFormateurEvent(FormateurEvent $formateurEvent): self
  196.     {
  197.         // set the owning side to null (unless already changed)
  198.         if ($this->formateurEvents->removeElement($formateurEvent) && $formateurEvent->getFormateur() === $this) {
  199.             $formateurEvent->setFormateur(null);
  200.         }
  201.         return $this;
  202.     }
  203.     public function getMissionProposee()
  204.     {
  205.         if ($this->missionProposee === null) {
  206.             return [];
  207.         }
  208.         return json_decode($this->missionProposeetrue512JSON_THROW_ON_ERROR);
  209.     }
  210.     /**
  211.      * @throws JsonException
  212.      */
  213.     public function addMissionProposee(string $idstring $title$state null$sevent=[]): self
  214.     {
  215.         $missionProposee json_decode((string) $this->missionProposeetrue512JSON_THROW_ON_ERROR) ?? [];
  216.         $exist false;
  217.         foreach ($missionProposee as &$item) {
  218.             if ($item['id'] === $id) {
  219.                 $item['title'] = $title;
  220.                 $item['state'] = $state;
  221.                 $exist true;
  222.             }
  223.         }
  224.         if (!$exist) {
  225.             $missionProposee[] = [
  226.                 'id' => $id,
  227.                 'title' => $title,
  228.                 'state' => $state,
  229.                 'week' => $sevent['week'],
  230.                 'start' => $sevent['start'],
  231.                 'end' => $sevent['end']
  232.             ];
  233.         }
  234.         $this->missionProposee json_encode($missionProposeeJSON_THROW_ON_ERROR);
  235.         return $this;
  236.     }
  237.     /**
  238.      * @throws JsonException
  239.      */
  240.     public function removeMissionProposee(string $idEvent): self
  241.     {
  242.         $missionProposee json_decode((string) $this->missionProposeetrue512JSON_THROW_ON_ERROR) ?? [];
  243.         foreach ($missionProposee as $key => $item) {
  244.             if ($item['id'] === $idEvent) {
  245.                 unset($missionProposee[$key]);
  246.             }
  247.         }
  248.         $this->missionProposee json_encode(array_values($missionProposee), JSON_THROW_ON_ERROR);
  249.         return $this;
  250.     }
  251.     public function setMissionProposee(?string $missionProposee): self
  252.     {
  253.         $this->missionProposee $missionProposee;
  254.         return $this;
  255.     }
  256.     /**
  257.      * @throws JsonException
  258.      */
  259.     public function getMissionProposeeById(string $id)
  260.     {
  261.         $missionProposee json_decode((string) $this->missionProposeetrue512JSON_THROW_ON_ERROR) ?? [];
  262.         foreach ($missionProposee as $item) {
  263.             if ($item['id'] === $id) {
  264.                 return $item;
  265.             }
  266.         }
  267.         return null;
  268.     }
  269.     /**
  270.      * @return Collection<int, Contrat>
  271.      */
  272.     public function getContrats(): Collection
  273.     {
  274.         return $this->contrats;
  275.     }
  276.     public function addContrat(Contrat $contrat): self
  277.     {
  278.         if (!$this->contrats->contains($contrat)) {
  279.             $this->contrats->add($contrat);
  280.             $contrat->addFormateur($this);
  281.         }
  282.         return $this;
  283.     }
  284.     public function removeContrat(Contrat $contrat): self
  285.     {
  286.         if ($this->contrats->removeElement($contrat)) {
  287.             $contrat->removeFormateur($this);
  288.         }
  289.         return $this;
  290.     }
  291.     /**
  292.      * @return Collection<int, LignePrestation>
  293.      */
  294.     public function getLignePrestations(): Collection
  295.     {
  296.         return $this->lignePrestations;
  297.     }
  298.     public function addLignePrestation(LignePrestation $lignePrestation): self
  299.     {
  300.         if (!$this->lignePrestations->contains($lignePrestation)) {
  301.             $this->lignePrestations->add($lignePrestation);
  302.             $lignePrestation->addFormateur($this);
  303.         }
  304.         return $this;
  305.     }
  306.     public function removeLignePrestation(LignePrestation $lignePrestation): self
  307.     {
  308.         if ($this->lignePrestations->removeElement($lignePrestation)) {
  309.             $lignePrestation->removeFormateur($this);
  310.         }
  311.         return $this;
  312.     }
  313.     /**
  314.      * @throws JsonException
  315.      */
  316.     public function verifMissionProposee(string $id): bool
  317.     {
  318.         $missionProposee json_decode((string) $this->missionProposeetrue512JSON_THROW_ON_ERROR) ?? [];
  319.         $exist false;
  320.         foreach ($missionProposee as $item) {
  321.             if ($item['id'] === $id) {
  322.                 $exist true;
  323.             }
  324.         }
  325.         return $exist;
  326.     }
  327.     /**
  328.      * @return Collection<int, ApprenantLivrable>
  329.      */
  330.     public function getApprenantLivrables(): Collection
  331.     {
  332.         return $this->apprenantLivrables;
  333.     }
  334.     public function addApprenantLivrable(ApprenantLivrable $apprenantLivrable): self
  335.     {
  336.         if (!$this->apprenantLivrables->contains($apprenantLivrable)) {
  337.             $this->apprenantLivrables->add($apprenantLivrable);
  338.             $apprenantLivrable->setFormateur($this);
  339.         }
  340.         return $this;
  341.     }
  342.     public function removeApprenantLivrable(ApprenantLivrable $apprenantLivrable): self
  343.     {
  344.         // set the owning side to null (unless already changed)
  345.         if ($this->apprenantLivrables->removeElement($apprenantLivrable) && $apprenantLivrable->getFormateur() === $this) {
  346.             $apprenantLivrable->setFormateur(null);
  347.         }
  348.         return $this;
  349.     }
  350.     /**
  351.      * @return Collection<int, HistoriqueComment>
  352.      */
  353.     public function getHistoriqueComments(): Collection
  354.     {
  355.         return $this->historiqueComments;
  356.     }
  357.     public function addHistoriqueComment(HistoriqueComment $historiqueComment): self
  358.     {
  359.         if (!$this->historiqueComments->contains($historiqueComment)) {
  360.             $this->historiqueComments->add($historiqueComment);
  361.             $historiqueComment->setFormateur($this);
  362.         }
  363.         return $this;
  364.     }
  365.     public function removeHistoriqueComment(HistoriqueComment $historiqueComment): self
  366.     {
  367.         // set the owning side to null (unless already changed)
  368.         if ($this->historiqueComments->removeElement($historiqueComment) && $historiqueComment->getFormateur() === $this) {
  369.             $historiqueComment->setFormateur($this);
  370.         }
  371.         return $this;
  372.     }
  373.     public function getDebutHabilitation(): ?DateTime
  374.     {
  375.         return $this->debutHabilitation;
  376.     }
  377.     public function setDebutHabilitation(?DateTime $debutHabilitation): self
  378.     {
  379.         $this->debutHabilitation $debutHabilitation;
  380.         return $this;
  381.     }
  382.     public function getFinHabilitation(): ?DateTime
  383.     {
  384.         return $this->finHabilitation;
  385.     }
  386.     public function setFinHabilitation(?DateTime $finHabilitation): self
  387.     {
  388.         $this->finHabilitation $finHabilitation;
  389.         return $this;
  390.     }
  391.     public function isJuryUniquement(): ?bool
  392.     {
  393.         return $this->juryUniquement;
  394.     }
  395.     /**
  396.      * @return Collection<int, Parcours>
  397.      */
  398.     public function getParcoursRNCP(): Collection
  399.     {
  400.         return $this->parcoursRNCP;
  401.     }
  402.     public function addParcoursRNCP(Parcours $parcoursRNCP): self
  403.     {
  404.         if (!$this->parcoursRNCP->contains($parcoursRNCP)) {
  405.             $this->parcoursRNCP->add($parcoursRNCP);
  406.             $parcoursRNCP->setFormateur($this);
  407.         }
  408.         return $this;
  409.     }
  410.     public function removeParcoursRNCP(Parcours $parcoursRNCP): self
  411.     {
  412.         // set the owning side to null (unless already changed)
  413.         if ($this->parcoursRNCP->removeElement($parcoursRNCP) && $parcoursRNCP->getFormateur() === $this) {
  414.             $parcoursRNCP->setFormateur(null);
  415.         }
  416.         return $this;
  417.     }
  418. }