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

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