src/Entity/Gestiform/Formations/Session/Session.php line 27
<?phpnamespace App\Entity\Gestiform\Formations\Session;use App\Entity\AbstractEntity;use App\Entity\Common\Adresse;use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;use App\Entity\Gestiform\Admin\Salle;use App\Entity\Gestiform\Admin\Site;use App\Entity\Gestiform\Formations\Actions\BondeCommandeParcour;use App\Entity\Gestiform\Formations\Catalogue\Parcours\Parcours;use App\Entity\Gestiform\Formations\Dossier\Dossier;use App\Entity\Gestiform\Formations\Dossier\HistoriqueDossier;use App\Entity\Gestiform\Formations\Reunion\Reunion;use App\Entity\Gestiform\Formations\Session\Planning\Planning;use App\Entity\Gestiform\Users\Employe;use App\Entity\Trait\ApiGestiformEntity;use App\Repository\Gestiform\Formations\Session\SessionRepository;use DateTime;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Serializer\Annotation as Serializer;#[ORM\Entity(repositoryClass: SessionRepository::class)]class Session extends AbstractEntity{use ApiGestiformEntity;#[ORM\Column(type: 'string', length: 255, nullable: false)]private string $intitule;#[ORM\Column(type: 'string', length: 65, nullable: true)]private ?string $type = null;#[ORM\Column(type: 'string', length: 65, nullable: true)]private ?string $sessionDokelio = null;#[ORM\Column(type: 'string', length: 65, nullable: true)]private ?string $dokelioParcours = null;#[ORM\Column(type: 'decimal', precision: 10, scale: 2, nullable: true)]private ?string $simulNbApprenants = null;#[ORM\Column(type: 'string', length: 255, nullable: true)]private ?string $numeroSession = null;#[ORM\Column(type: 'integer', nullable: true)]private ?int $duree = null;#[ORM\Column(type: 'datetime', nullable: false)]private ?DateTime $dateDebut = null;#[ORM\Column(type: 'datetime', nullable: true)]private ?DateTime $dateDebutAffichage = null;#[ORM\Column(type: 'datetime', nullable: true)]private ?DateTime $dateFinAffichage = null;#[Serializer\Ignore]#[ORM\OneToMany(mappedBy: 'session', targetEntity: Dossier::class)]private Collection $dossiers;#[ORM\Column(type: 'boolean')]private bool $sitePartenaire = false;#[ORM\Column(type: 'boolean')]private bool $guaranteed = false;#[ORM\Column(type: 'boolean')]private bool $permenant = false;#[ORM\Column(type: 'boolean')]private bool $publieSite = false;#[ORM\Column(type: 'boolean')]private bool $datesLarges = false;#[ORM\JoinColumn(nullable: true)]#[ORM\ManyToOne(targetEntity: Salle::class, inversedBy: 'sessions')]private ?Salle $salleDefaut = null;#[ORM\JoinColumn(nullable: true)]#[ORM\ManyToOne(targetEntity: Parcours::class, cascade: ['persist'], inversedBy: 'sessions')]private ?Parcours $parcours = null;#[ORM\JoinColumn(nullable: true)]#[ORM\ManyToOne(targetEntity: Adresse::class)]private ?Adresse $adressePartenaire = null;#[ORM\ManyToOne(targetEntity: Masterlistelg::class)]private ?Masterlistelg $statut = null;#[Serializer\Ignore]#[ORM\JoinColumn(nullable: true)]#[ORM\ManyToOne(targetEntity: Employe::class)]private ?Employe $referentPedagogique = null;#[Serializer\Ignore]#[ORM\JoinColumn(nullable: true)]#[ORM\ManyToOne(targetEntity: Employe::class)]private ?Employe $referentCoach = null;#[Serializer\Ignore]#[ORM\JoinColumn(nullable: true)]#[ORM\ManyToOne(targetEntity: Employe::class)]private ?Employe $referentAdministratif = null;#[Serializer\Ignore]#[ORM\JoinColumn(nullable: true)]#[ORM\ManyToOne(targetEntity: Employe::class)]private ?Employe $referentHandicap = null;#[ORM\JoinColumn(nullable: true)]#[ORM\OneToOne(inversedBy: 'session', targetEntity: Planning::class, cascade: ['persist'])]private ?Planning $planning=null;#[ORM\OneToMany(mappedBy: 'session', targetEntity: Reunion::class, cascade: ['persist'])]private Collection $reunions;#[ORM\OneToMany(mappedBy: 'session', targetEntity: HistoriqueDossier::class, cascade: ['persist'])]private Collection $historiqueDossiers;#[ORM\OneToMany(mappedBy: 'session', targetEntity: SessionBlocModule::class, cascade: ['all'])]private Collection $sessionBlocModules;#[ORM\ManyToMany(targetEntity: BondeCommandeParcour::class, mappedBy: 'sessions')]private Collection $bondeCommandeParcours;#[Serializer\Ignore]#[ORM\JoinColumn(nullable: true)]#[ORM\ManyToOne(targetEntity: Site::class)]private ?Site $site = null;public function __construct(){$this->dossiers = new ArrayCollection();$this->reunions = new ArrayCollection();$this->historiqueDossiers = new ArrayCollection();$this->sessionBlocModules = new ArrayCollection();$this->bondeCommandeParcours = new ArrayCollection();}/*** @return Collection<int, Dossier>*/public function getDossiers(): Collection{return $this->dossiers;}public function addDossier(Dossier $dossier): self{if (!$this->dossiers->contains($dossier)) {$this->dossiers->add($dossier);$dossier->setSession($this);}return $this;}public function removeDossier(Dossier $dossier): self{// set the owning side to null (unless already changed)if ($this->dossiers->removeElement($dossier) && $dossier->getSession() === $this) {$dossier->setSession(null);}return $this;}public function getIntitule(): ?string{return $this->intitule;}public function setIntitule(string $intitule): self{$this->intitule = $intitule;return $this;}public function getType(): ?string{return $this->type;}public function setType(string $type): self{$this->type = $type;return $this;}public function getSessionDokelio(): ?string{return $this->sessionDokelio;}public function setSessionDokelio(string $sessionDokelio): self{$this->sessionDokelio = $sessionDokelio;return $this;}public function getDokelioParcours(): ?string{return $this->dokelioParcours;}public function setDokelioParcours(string $dokelioParcours): self{$this->dokelioParcours = $dokelioParcours;return $this;}public function getSimulNbApprenants(): ?float{return $this->simulNbApprenants;}public function setSimulNbApprenants(?float $simulNbApprenants): self{$this->simulNbApprenants = $simulNbApprenants;return $this;}public function getNumeroSession(): ?string{return $this->numeroSession;}public function setNumeroSession(?string $numeroSession): self{$this->numeroSession = $numeroSession;return $this;}public function getDateDebut(): ?DateTime{return $this->dateDebut;}public function setDateDebut(DateTime $dateDebut): self{$this->dateDebut = $dateDebut;return $this;}public function getDateDebutAffichage(): ?DateTime{return $this->dateDebutAffichage;}public function setDateDebutAffichage(DateTime $dateDebutAffichage): self{$this->dateDebutAffichage = $dateDebutAffichage;return $this;}public function getDateFinAffichage(): ?DateTime{return $this->dateFinAffichage;}public function setDateFinAffichage(DateTime $dateFinAffichage): self{$this->dateFinAffichage = $dateFinAffichage;return $this;}public function isSitePartenaire(): ?bool{return $this->sitePartenaire;}public function setSitePartenaire(bool $sitePartenaire): self{$this->sitePartenaire = $sitePartenaire;return $this;}public function isPublieSite(): ?bool{return $this->publieSite;}public function setPublieSite(bool $publieSite): self{$this->publieSite = $publieSite;return $this;}public function isDatesLarges(): ?bool{return $this->datesLarges;}public function setDatesLarges(bool $datesLarges): self{$this->datesLarges = $datesLarges;return $this;}public function getSalleDefaut(): ?Salle{return $this->salleDefaut;}public function setSalleDefaut(?Salle $salleDefaut): self{$this->salleDefaut = $salleDefaut;return $this;}public function getParcours(): ?Parcours{return $this->parcours;}public function setParcours(?Parcours $parcours): self{$this->parcours = $parcours;return $this;}public function getAdressePartenaire(): ?Adresse{return $this->adressePartenaire;}public function setAdressePartenaire(?Adresse $adressePartenaire): self{$this->adressePartenaire = $adressePartenaire;return $this;}public function getStatut(): ?Masterlistelg{return $this->statut;}public function setStatut(?Masterlistelg $statut): self{$this->statut = $statut;return $this;}public function getReferentPedagogique(): ?Employe{return $this->referentPedagogique;}public function setReferentPedagogique(?Employe $referentPedagogique): self{$this->referentPedagogique = $referentPedagogique;return $this;}public function getReferentCoach(): ?Employe{return $this->referentCoach;}public function setReferentCoach(?Employe $referentCoach): self{$this->referentCoach = $referentCoach;return $this;}public function getReferentAdministratif(): ?Employe{return $this->referentAdministratif;}public function setReferentAdministratif(?Employe $referentAdministratif): self{$this->referentAdministratif = $referentAdministratif;return $this;}public function getReferentHandicap(): ?Employe{return $this->referentHandicap;}public function setReferentHandicap(?Employe $referentHandicap): self{$this->referentHandicap = $referentHandicap;return $this;}public function getPlanning(): ?Planning{return $this->planning;}public function setPlanning(?Planning $planning): self{$this->planning = $planning;return $this;}/*** @return Collection<int, Reunion>*/public function getReunions(): Collection{return $this->reunions;}public function addReunion(Reunion $reunion): self{if (!$this->reunions->contains($reunion)) {$this->reunions->add($reunion);$reunion->setSession($this);}return $this;}public function removeReunion(Reunion $reunion): self{// set the owning side to null (unless already changed)if ($this->reunions->removeElement($reunion) && $reunion->getSession() === $this) {$reunion->setSession(null);}return $this;}/*** @return Collection<int, HistoriqueDossier>*/public function getHistoriqueDossiers(): Collection{return $this->historiqueDossiers;}public function addHistoriqueDossier(HistoriqueDossier $historiqueDossier): self{if (!$this->historiqueDossiers->contains($historiqueDossier)) {$this->historiqueDossiers->add($historiqueDossier);$historiqueDossier->setSession($this);}return $this;}public function removeHistoriqueDossier(HistoriqueDossier $historiqueDossier): self{// set the owning side to null (unless already changed)if ($this->historiqueDossiers->removeElement($historiqueDossier) && $historiqueDossier->getSession() === $this) {$historiqueDossier->setSession(null);}return $this;}public function getSessionBlocModules(): Collection{return $this->sessionBlocModules;}public function addSessionBlocModule(SessionBlocModule $sessionBlocModule): self{if (!$this->sessionBlocModules->contains($sessionBlocModule)) {$this->sessionBlocModules->add($sessionBlocModule);$sessionBlocModule->setSession($this);}return $this;}public function removeSessionBlocModule(SessionBlocModule $sessionBlocModule): self{// set the owning side to null (unless already changed)if ($this->sessionBlocModules->removeElement($sessionBlocModule) && $sessionBlocModule->getSession() === $this) {$sessionBlocModule->setSession(null);}return $this;}/*** @return Collection<int, BondeCommandeParcour>*/public function getBondeCommandeParcours(): Collection{return $this->bondeCommandeParcours;}public function addBondeCommandeParcour(BondeCommandeParcour $bondeCommandeParcour): self{if (!$this->bondeCommandeParcours->contains($bondeCommandeParcour)) {$this->bondeCommandeParcours->add($bondeCommandeParcour);$bondeCommandeParcour->addSession($this);}return $this;}public function removeBondeCommandeParcour(BondeCommandeParcour $bondeCommandeParcour): self{if ($this->bondeCommandeParcours->removeElement($bondeCommandeParcour)) {$bondeCommandeParcour->removeSession($this);}return $this;}public function getDuree(): ?int{return $this->duree;}public function setDuree(?int $duree): self{$this->duree = $duree;return $this;}public function getSite(): ?Site{return $this->site;}public function setSite(?Site $site): self{$this->site = $site;return $this;}/*** @throws \DateMalformedStringException*/public function getAllSemaineSession(): array{$resultat=[];if($this->getPlanning()->getStart() instanceof \DateTime){$datecourant=clone $this->getPlanning()?->getStart();$dateFin=$this->getPlanning()->getEnd();$i=0;while($datecourant <= $dateFin && $i < 150){$i++;$monweek=clone $datecourant;$resultat[]=$monweek;$datecourant->modify("+7 day");$datecourant->modify('monday this week');}return $resultat;}else{return [];}}public function isPermenant(): ?bool{return $this->permenant;}public function setPermenant(bool $permenant): self{$this->permenant = $permenant;return $this;}public function isGuaranteed(): ?bool{return $this->guaranteed;}public function setGuaranteed(bool $guaranteed): self{$this->guaranteed = $guaranteed;return $this;}}