src/Entity/Gestiform/Formations/Session/Session.php line 27

  1. <?php
  2. namespace App\Entity\Gestiform\Formations\Session;
  3. use App\Entity\AbstractEntity;
  4. use App\Entity\Common\Adresse;
  5. use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;
  6. use App\Entity\Gestiform\Admin\Salle;
  7. use App\Entity\Gestiform\Admin\Site;
  8. use App\Entity\Gestiform\Formations\Actions\BondeCommandeParcour;
  9. use App\Entity\Gestiform\Formations\Catalogue\Parcours\Parcours;
  10. use App\Entity\Gestiform\Formations\Dossier\Dossier;
  11. use App\Entity\Gestiform\Formations\Dossier\HistoriqueDossier;
  12. use App\Entity\Gestiform\Formations\Reunion\Reunion;
  13. use App\Entity\Gestiform\Formations\Session\Planning\Planning;
  14. use App\Entity\Gestiform\Users\Employe;
  15. use App\Entity\Trait\ApiGestiformEntity;
  16. use App\Repository\Gestiform\Formations\Session\SessionRepository;
  17. use DateTime;
  18. use Doctrine\Common\Collections\ArrayCollection;
  19. use Doctrine\Common\Collections\Collection;
  20. use Doctrine\ORM\Mapping as ORM;
  21. use Symfony\Component\Serializer\Attribute as Serializer;
  22. #[ORM\Entity(repositoryClassSessionRepository::class)]
  23. class Session extends AbstractEntity
  24. {
  25.     use ApiGestiformEntity;
  26.     #[ORM\Column(type'string'length255nullablefalse)]
  27.     private string $intitule;
  28.     #[ORM\Column(type'string'length65nullabletrue)]
  29.     private ?string $type null;
  30.     #[ORM\Column(type'string'length65nullabletrue)]
  31.     private ?string $sessionDokelio null;
  32.     #[ORM\Column(type'string'length65nullabletrue)]
  33.     private ?string $dokelioParcours null;
  34.     #[ORM\Column(type'decimal'precision10scale2nullabletrue)]
  35.     private ?string $simulNbApprenants null;
  36.     #[ORM\Column(type'string'length255nullabletrue)]
  37.     private ?string $numeroSession null;
  38.     #[ORM\Column(type'integer'nullabletrue)]
  39.     private ?int $duree null;
  40.     #[ORM\Column(type'datetime'nullablefalse)]
  41.     private ?DateTime $dateDebut null;
  42.     #[ORM\Column(type'datetime'nullabletrue)]
  43.     private ?DateTime $dateDebutAffichage null;
  44.     #[ORM\Column(type'datetime'nullabletrue)]
  45.     private ?DateTime $dateFinAffichage null;
  46.     #[ORM\Column(type'boolean')]
  47.     private bool $sitePartenaire false;
  48.     #[ORM\Column(type'boolean')]
  49.     private bool $guaranteed false;
  50.     #[ORM\Column(type'boolean')]
  51.     private bool $permenant false;
  52.     #[ORM\Column(type'boolean')]
  53.     private bool $publieSite false;
  54.     #[ORM\Column(type'boolean')]
  55.     private bool $datesLarges false;
  56.     #[ORM\Column(type'string'length20nullabletrue)]
  57.     private ?string $lieu 'Interne';
  58.     #[ORM\Column(type'string'length50nullabletrue)]
  59.     private ?string $modaliteParDefaut null;
  60.     #[ORM\JoinColumn(nullabletrue)]
  61.     #[ORM\ManyToOne(targetEntitySalle::class, inversedBy'sessions')]
  62.     private ?Salle $salleDefaut null;
  63.     #[ORM\ManyToOne(targetEntityParcours::class, inversedBy'sessions')]
  64.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  65.     private ?Parcours $parcours null;
  66.     #[ORM\JoinColumn(nullabletrue)]
  67.     #[ORM\ManyToOne(targetEntityAdresse::class)]
  68.     private ?Adresse $adressePartenaire null;
  69.     #[ORM\ManyToOne(targetEntityMasterlistelg::class)]
  70.     private ?Masterlistelg $statut null;
  71.     #[Serializer\Ignore]
  72.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  73.     #[ORM\ManyToOne(targetEntityEmploye::class)]
  74.     private ?Employe $referentPedagogique null;
  75.     #[Serializer\Ignore]
  76.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  77.     #[ORM\ManyToOne(targetEntityEmploye::class)]
  78.     private ?Employe $referentCoach null;
  79.     #[Serializer\Ignore]
  80.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  81.     #[ORM\ManyToOne(targetEntityEmploye::class)]
  82.     private ?Employe $referentAdministratif null;
  83.     #[Serializer\Ignore]
  84.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  85.     #[ORM\ManyToOne(targetEntityEmploye::class)]
  86.     private ?Employe $referentHandicap null;
  87.     #[ORM\JoinColumn(nullabletrue)]
  88.     #[ORM\OneToOne(targetEntityPlanning::class, inversedBy'session'cascade: ['persist'])]
  89.     private ?Planning $planning=null;
  90.     #[Serializer\Ignore]
  91.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  92.     #[ORM\ManyToOne(targetEntitySite::class)]
  93.     private ?Site $site null;
  94.     #[ORM\OneToMany(targetEntityReunion::class, mappedBy'session'cascade: ['persist'])]
  95.     private Collection $reunions;
  96.     #[ORM\OneToMany(targetEntityHistoriqueDossier::class, mappedBy'session'cascade: ['persist'])]
  97.     private Collection $historiqueDossiers;
  98.     #[ORM\OneToMany(targetEntitySessionBlocModule::class, mappedBy'session'cascade: ['all'])]
  99.     private Collection $sessionBlocModules;
  100.     #[ORM\ManyToMany(targetEntityBondeCommandeParcour::class, mappedBy'sessions')]
  101.     private Collection $bondeCommandeParcours;
  102.     #[Serializer\Ignore]
  103.     #[ORM\OneToMany(targetEntityDossier::class, mappedBy'session')]
  104.     private Collection $dossiers;
  105.     public function __construct()
  106.     {
  107.         $this->dossiers = new ArrayCollection();
  108.         $this->reunions = new ArrayCollection();
  109.         $this->historiqueDossiers = new ArrayCollection();
  110.         $this->sessionBlocModules = new ArrayCollection();
  111.         $this->bondeCommandeParcours = new ArrayCollection();
  112.     }
  113.     /**
  114.      * @return Collection<int, Dossier>
  115.      */
  116.     public function getDossiers(): Collection
  117.     {
  118.         return $this->dossiers;
  119.     }
  120.     public function addDossier(Dossier $dossier): self
  121.     {
  122.         if (!$this->dossiers->contains($dossier)) {
  123.             $this->dossiers->add($dossier);
  124.             $dossier->setSession($this);
  125.         }
  126.         return $this;
  127.     }
  128.     public function getLieu(): ?string
  129.     {
  130.         return $this->lieu;
  131.     }
  132.     public function setLieu(?string $lieu): self
  133.     {
  134.         $this->lieu $lieu;
  135.         return $this;
  136.     }
  137.     public function getModaliteParDefaut(): ?string
  138.     {
  139.         return $this->modaliteParDefaut;
  140.     }
  141.     public function setModaliteParDefaut(?string $modaliteParDefaut): self
  142.     {
  143.         $this->modaliteParDefaut $modaliteParDefaut;
  144.         return $this;
  145.     }
  146.     public function removeDossier(Dossier $dossier): self
  147.     {
  148.         // set the owning side to null (unless already changed)
  149.         if ($this->dossiers->removeElement($dossier) && $dossier->getSession() === $this) {
  150.             $dossier->setSession(null);
  151.         }
  152.         return $this;
  153.     }
  154.     public function getIntitule(): ?string
  155.     {
  156.         return $this->intitule;
  157.     }
  158.     public function setIntitule(string $intitule): self
  159.     {
  160.         $this->intitule $intitule;
  161.         return $this;
  162.     }
  163.     public function getType(): ?string
  164.     {
  165.         return $this->type;
  166.     }
  167.     public function setType(string $type): self
  168.     {
  169.         $this->type $type;
  170.         return $this;
  171.     }
  172.     public function getSessionDokelio(): ?string
  173.     {
  174.         return $this->sessionDokelio;
  175.     }
  176.     public function setSessionDokelio(string $sessionDokelio): self
  177.     {
  178.         $this->sessionDokelio $sessionDokelio;
  179.         return $this;
  180.     }
  181.     public function getDokelioParcours(): ?string
  182.     {
  183.         return $this->dokelioParcours;
  184.     }
  185.     public function setDokelioParcours(string $dokelioParcours): self
  186.     {
  187.         $this->dokelioParcours $dokelioParcours;
  188.         return $this;
  189.     }
  190.     public function getSimulNbApprenants(): ?float
  191.     {
  192.         return $this->simulNbApprenants;
  193.     }
  194.     public function setSimulNbApprenants(?float $simulNbApprenants): self
  195.     {
  196.         $this->simulNbApprenants $simulNbApprenants;
  197.         return $this;
  198.     }
  199.     public function getNumeroSession(): ?string
  200.     {
  201.         return $this->numeroSession;
  202.     }
  203.     public function setNumeroSession(?string $numeroSession): self
  204.     {
  205.         $this->numeroSession $numeroSession;
  206.         return $this;
  207.     }
  208.     public function getDateDebut(): ?DateTime
  209.     {
  210.         return $this->dateDebut;
  211.     }
  212.     public function setDateDebut(DateTime $dateDebut): self
  213.     {
  214.         $this->dateDebut $dateDebut;
  215.         return $this;
  216.     }
  217.     public function getDateDebutAffichage(): ?DateTime
  218.     {
  219.         return $this->dateDebutAffichage;
  220.     }
  221.     public function setDateDebutAffichage(DateTime $dateDebutAffichage): self
  222.     {
  223.         $this->dateDebutAffichage $dateDebutAffichage;
  224.         return $this;
  225.     }
  226.     public function getDateFinAffichage(): ?DateTime
  227.     {
  228.         return $this->dateFinAffichage;
  229.     }
  230.     public function setDateFinAffichage(DateTime $dateFinAffichage): self
  231.     {
  232.         $this->dateFinAffichage $dateFinAffichage;
  233.         return $this;
  234.     }
  235.     public function isSitePartenaire(): ?bool
  236.     {
  237.         return $this->sitePartenaire;
  238.     }
  239.     public function setSitePartenaire(bool $sitePartenaire): self
  240.     {
  241.         $this->sitePartenaire $sitePartenaire;
  242.         return $this;
  243.     }
  244.     public function isPublieSite(): ?bool
  245.     {
  246.         return $this->publieSite;
  247.     }
  248.     public function setPublieSite(bool $publieSite): self
  249.     {
  250.         $this->publieSite $publieSite;
  251.         return $this;
  252.     }
  253.     public function isDatesLarges(): ?bool
  254.     {
  255.         return $this->datesLarges;
  256.     }
  257.     public function setDatesLarges(bool $datesLarges): self
  258.     {
  259.         $this->datesLarges $datesLarges;
  260.         return $this;
  261.     }
  262.     public function getSalleDefaut(): ?Salle
  263.     {
  264.         return $this->salleDefaut;
  265.     }
  266.     public function setSalleDefaut(?Salle $salleDefaut): self
  267.     {
  268.         $this->salleDefaut $salleDefaut;
  269.         return $this;
  270.     }
  271.     public function getParcours(): ?Parcours
  272.     {
  273.         return $this->parcours;
  274.     }
  275.     public function setParcours(?Parcours $parcours): self
  276.     {
  277.         $this->parcours $parcours;
  278.         return $this;
  279.     }
  280.     public function getAdressePartenaire(): ?Adresse
  281.     {
  282.         return $this->adressePartenaire;
  283.     }
  284.     public function setAdressePartenaire(?Adresse $adressePartenaire): self
  285.     {
  286.         $this->adressePartenaire $adressePartenaire;
  287.         return $this;
  288.     }
  289.     public function getStatut(): ?Masterlistelg
  290.     {
  291.         return $this->statut;
  292.     }
  293.     public function setStatut(?Masterlistelg $statut): self
  294.     {
  295.         $this->statut $statut;
  296.         return $this;
  297.     }
  298.     public function getReferentPedagogique(): ?Employe
  299.     {
  300.         return $this->referentPedagogique;
  301.     }
  302.     public function setReferentPedagogique(?Employe $referentPedagogique): self
  303.     {
  304.         $this->referentPedagogique $referentPedagogique;
  305.         return $this;
  306.     }
  307.     public function getReferentCoach(): ?Employe
  308.     {
  309.         return $this->referentCoach;
  310.     }
  311.     public function setReferentCoach(?Employe $referentCoach): self
  312.     {
  313.         $this->referentCoach $referentCoach;
  314.         return $this;
  315.     }
  316.     public function getReferentAdministratif(): ?Employe
  317.     {
  318.         return $this->referentAdministratif;
  319.     }
  320.     public function setReferentAdministratif(?Employe $referentAdministratif): self
  321.     {
  322.         $this->referentAdministratif $referentAdministratif;
  323.         return $this;
  324.     }
  325.     public function getReferentHandicap(): ?Employe
  326.     {
  327.         return $this->referentHandicap;
  328.     }
  329.     public function setReferentHandicap(?Employe $referentHandicap): self
  330.     {
  331.         $this->referentHandicap $referentHandicap;
  332.         return $this;
  333.     }
  334.     public function getPlanning(): ?Planning
  335.     {
  336.         return $this->planning;
  337.     }
  338.     public function setPlanning(?Planning $planning): self
  339.     {
  340.         $this->planning $planning;
  341.         return $this;
  342.     }
  343.     /**
  344.      * @return Collection<int, Reunion>
  345.      */
  346.     public function getReunions(): Collection
  347.     {
  348.         return $this->reunions;
  349.     }
  350.     public function addReunion(Reunion $reunion): self
  351.     {
  352.         if (!$this->reunions->contains($reunion)) {
  353.             $this->reunions->add($reunion);
  354.             $reunion->setSession($this);
  355.         }
  356.         return $this;
  357.     }
  358.     public function removeReunion(Reunion $reunion): self
  359.     {
  360.         // set the owning side to null (unless already changed)
  361.         if ($this->reunions->removeElement($reunion) && $reunion->getSession() === $this) {
  362.             $reunion->setSession(null);
  363.         }
  364.         return $this;
  365.     }
  366.     /**
  367.      * @return Collection<int, HistoriqueDossier>
  368.      */
  369.     public function getHistoriqueDossiers(): Collection
  370.     {
  371.         return $this->historiqueDossiers;
  372.     }
  373.     public function addHistoriqueDossier(HistoriqueDossier $historiqueDossier): self
  374.     {
  375.         if (!$this->historiqueDossiers->contains($historiqueDossier)) {
  376.             $this->historiqueDossiers->add($historiqueDossier);
  377.             $historiqueDossier->setSession($this);
  378.         }
  379.         return $this;
  380.     }
  381.     public function removeHistoriqueDossier(HistoriqueDossier $historiqueDossier): self
  382.     {
  383.         // set the owning side to null (unless already changed)
  384.         if ($this->historiqueDossiers->removeElement($historiqueDossier) && $historiqueDossier->getSession() === $this) {
  385.             $historiqueDossier->setSession(null);
  386.         }
  387.         return $this;
  388.     }
  389.     public function getSessionBlocModules(): Collection
  390.     {
  391.         return $this->sessionBlocModules;
  392.     }
  393.     public function addSessionBlocModule(SessionBlocModule $sessionBlocModule): self
  394.     {
  395.         if (!$this->sessionBlocModules->contains($sessionBlocModule)) {
  396.             $this->sessionBlocModules->add($sessionBlocModule);
  397.             $sessionBlocModule->setSession($this);
  398.         }
  399.         return $this;
  400.     }
  401.     public function removeSessionBlocModule(SessionBlocModule $sessionBlocModule): self
  402.     {
  403.         // set the owning side to null (unless already changed)
  404.         if ($this->sessionBlocModules->removeElement($sessionBlocModule) && $sessionBlocModule->getSession() === $this) {
  405.             $sessionBlocModule->setSession(null);
  406.         }
  407.         return $this;
  408.     }
  409.     /**
  410.      * @return Collection<int, BondeCommandeParcour>
  411.      */
  412.     public function getBondeCommandeParcours(): Collection
  413.     {
  414.         return $this->bondeCommandeParcours;
  415.     }
  416.     public function addBondeCommandeParcour(BondeCommandeParcour $bondeCommandeParcour): self
  417.     {
  418.         if (!$this->bondeCommandeParcours->contains($bondeCommandeParcour)) {
  419.             $this->bondeCommandeParcours->add($bondeCommandeParcour);
  420.             $bondeCommandeParcour->addSession($this);
  421.         }
  422.         return $this;
  423.     }
  424.     public function removeBondeCommandeParcour(BondeCommandeParcour $bondeCommandeParcour): self
  425.     {
  426.         if ($this->bondeCommandeParcours->removeElement($bondeCommandeParcour)) {
  427.             $bondeCommandeParcour->removeSession($this);
  428.         }
  429.         return $this;
  430.     }
  431.     public function getDuree(): ?int
  432.     {
  433.         return $this->duree;
  434.     }
  435.     public function setDuree(?int $duree): self
  436.     {
  437.         $this->duree $duree;
  438.         return $this;
  439.     }
  440.     public function getSite(): ?Site
  441.     {
  442.         return $this->site;
  443.     }
  444.     public function setSite(?Site $site): self
  445.     {
  446.         $this->site $site;
  447.         return $this;
  448.     }
  449.     /**
  450.      * @throws \DateMalformedStringException
  451.      */
  452.     public function getAllSemaineSession(): array
  453.     {
  454.         $resultat=[];
  455.         if($this->getPlanning()->getStart() instanceof \DateTime){
  456.         $datecourant=clone $this->getPlanning()?->getStart();
  457.         $dateFin=$this->getPlanning()->getEnd();
  458.         $i=0;
  459.         while($datecourant <= $dateFin && $i 150)
  460.         {
  461.             $i++;
  462.             $monweek=clone $datecourant;
  463.             $resultat[]=$monweek;
  464.             $datecourant->modify("+7 day");
  465.             $datecourant->modify('monday this week');
  466.         }
  467.         return $resultat;
  468.         }
  469.         else
  470.         {
  471.             return [];
  472.         }
  473.     }
  474.     public function isPermenant(): ?bool
  475.     {
  476.         return $this->permenant;
  477.     }
  478.     public function setPermenant(bool $permenant): self
  479.     {
  480.         $this->permenant $permenant;
  481.         return $this;
  482.     }
  483.     public function isGuaranteed(): ?bool
  484.     {
  485.         return $this->guaranteed;
  486.     }
  487.     public function setGuaranteed(bool $guaranteed): self
  488.     {
  489.         $this->guaranteed $guaranteed;
  490.         return $this;
  491.     }
  492. }