src/Entity/Gestiform/Formations/Session/Planning/Event.php line 20
<?phpnamespace App\Entity\Gestiform\Formations\Session\Planning;;use App\Entity\AbstractEntity;use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;use App\Entity\Gestiform\Formations\Catalogue\Module\Module;use App\Entity\Gestiform\Formations\Emargement\Emargement;use App\Entity\Gestiform\Formations\Session\FormateurEvent;use App\Entity\Gestiform\Formations\Session\SalleEvent;use App\Entity\Gestiform\Formations\Session\SessionBlocModule;use App\Repository\Gestiform\Formations\Session\Planning\EventRepository;use DateTime;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: EventRepository::class)]class Event extends AbstractEntity{#[ORM\Column(type: 'datetime')]private DateTime $start;#[ORM\Column(type: 'datetime')]private ?DateTime $end = null;#[ORM\Column(type: 'integer')]private int $hours;#[ORM\JoinColumn(nullable: true)]#[ORM\ManyToOne(targetEntity: Masterlistelg::class)]private ?Masterlistelg $modalite = null;#[ORM\ManyToOne(targetEntity: Event::class, inversedBy: 'children')]private ?Event $parent = null;#[ORM\OneToMany(mappedBy: 'parent', targetEntity: Event::class, cascade: ['persist', 'remove'])]private Collection $children;#[ORM\OneToMany(mappedBy: 'event', targetEntity: PlanningEvent::class, cascade: ['persist', 'remove'])]private Collection $planningEvents;#[ORM\ManyToOne(targetEntity: SessionBlocModule::class, inversedBy: 'events')]private ?SessionBlocModule $sessionBlocModule = null;#[ORM\ManyToOne(targetEntity: Accompagnement::class, cascade: ['persist'], inversedBy: 'events')]private ?Accompagnement $accompagnement = null;#[ORM\ManyToOne(targetEntity: Module::class, cascade: ['persist'], inversedBy: 'events')]private ?Module $module = null;#[ORM\ManyToOne(targetEntity: Jury::class, cascade: ['persist'], inversedBy: 'events')]private ?Jury $jury = null;#[ORM\ManyToOne(targetEntity: Stage::class, cascade: ['persist'], inversedBy: 'events')]private ?Stage $stage = null;#[ORM\OneToMany(mappedBy: 'evenement', targetEntity: FormateurEvent::class, cascade: ['persist', 'remove'])]private Collection $formateurEvents;#[ORM\OneToMany(mappedBy: 'event', targetEntity: SalleEvent::class, cascade: ['persist', 'remove'])]private Collection $salleEvents;#[ORM\OneToMany(mappedBy: 'event', targetEntity: Emargement::class, cascade: ['persist', 'remove'])]private Collection $emargements;#[ORM\Column(type: 'boolean', nullable: true)]private ?bool $sendconvocationstagiaire = false;#[ORM\Column(type: 'boolean', nullable: true)]private ?bool $sendconvocationformateur = false;#[ORM\Column(type: 'boolean')]private bool $tempsPriseEnCompte = true;#[ORM\OneToMany(mappedBy: 'event', targetEntity: FormulaireEvent::class)]private Collection $formulaireEvents;public function __construct(){$this->children = new ArrayCollection();$this->planningEvents = new ArrayCollection();$this->salleEvents = new ArrayCollection();$this->formateurEvents = new ArrayCollection();$this->emargements = new ArrayCollection();$this->formulaireEvents = new ArrayCollection();}public function getStart(): ?DateTime{return $this->start;}public function setStart(DateTime $start): self{$this->start = $start;return $this;}public function getEnd(): ?DateTime{return $this->end;}public function setEnd(?DateTime $end): self{$this->end = $end;return $this;}public function getModalite(): ?Masterlistelg{return $this->modalite;}public function getModaliteOrParentModalite(): ?Masterlistelg{return $this->modalite ?? $this->getParent()?->getModalite();}public function setModalite(?Masterlistelg $modalite): self{$this->modalite = $modalite;return $this;}public function getPlanningEvents(): Collection{return $this->planningEvents;}public function addPlanningEvent(PlanningEvent $planningEvent): self{if (!$this->planningEvents->contains($planningEvent)) {$this->planningEvents[] = $planningEvent;$planningEvent->setEvent($this);}return $this;}public function removePlanningEvent(PlanningEvent $planningEvent): self{$this->planningEvents->removeElement($planningEvent);return $this;}public function getParent(): ?self{return $this->parent;}public function setParent(?self $parent): self{$this->parent = $parent;return $this;}/*** @return Collection<int, self>*/public function getChildren(): Collection{return $this->children;}public function setChildren(Collection $children): self{$this->children = $children;return $this;}public function addChild(self $child): self{if (!$this->children->contains($child)) {$this->children[] = $child;$child->setParent($this);}return $this;}public function removeChild(self $child): self{// set the owning side to null (unless already changed)if ($this->children->removeElement($child) && $child->getParent() === $this) {$child->setParent(null);}return $this;}public function getSessionBlocModule(): ?SessionBlocModule{return $this->sessionBlocModule;}public function getSessionBlocModuleOrParentSessionBlocModule(): ?SessionBlocModule{return $this->sessionBlocModule ?? $this->getParent()?->getSessionBlocModule();}public function setSessionBlocModule(?SessionBlocModule $sessionBlocModule): self{$this->sessionBlocModule = $sessionBlocModule;return $this;}public function getAccompagnement(): ?Accompagnement{return $this->accompagnement;}public function getAccompagnementOrParentAccompagnement(): ?Accompagnement{return $this->accompagnement ?? $this->getParent()?->getAccompagnement();}public function setAccompagnement(?Accompagnement $accompagnement): self{$this->accompagnement = $accompagnement;return $this;}public function getModule(): ?Module{return $this->module;}public function getModuleOrParentModule(): ?Module{return $this->module ?? $this->getParent()?->getModule();}public function setModule(?Module $module): self{$this->module = $module;return $this;}public function getJury(): ?Jury{return $this->jury;}public function getJuryOrParentJury(): ?Jury{return $this->jury ?? $this->getParent()?->getJury();}public function setJury(?Jury $jury): self{$this->jury = $jury;return $this;}public function getStage(): ?Stage{return $this->stage;}public function getStageOrParentStage(): ?Stage{return $this->stage ?? $this->getParent()?->getStage();}public function setStage(?Stage $stage): self{$this->stage = $stage;return $this;}/*** @return Collection<int, FormateurEvent>*/public function getFormateurEvents(): Collection{return $this->formateurEvents;}public function addFormateurEvent(FormateurEvent $formateurEvent): self{if (!$this->formateurEvents->contains($formateurEvent)) {$this->formateurEvents->add($formateurEvent);$formateurEvent->setEvenement($this);}return $this;}public function removeFormateurEvent(FormateurEvent $formateurEvent): self{// set the owning side to null (unless already changed)if ($this->formateurEvents->removeElement($formateurEvent) && $formateurEvent->getEvenement() === $this) {$formateurEvent->setEvenement(null);}return $this;}public function getHours(): int{return $this->hours;}public function setHours(int $hours): self{$this->hours = $hours;return $this;}public function getSalleEvents(): Collection{return $this->salleEvents;}public function addSalleEvent(SalleEvent $salleEvent): self{if (!$this->salleEvents->contains($salleEvent)) {$this->salleEvents->add($salleEvent);}return $this;}public function removeSalleEvent(SalleEvent $salleEvent): self{$this->salleEvents->removeElement($salleEvent);return $this;}public function getSalleEventOrParentSalleEvent(): Collection{if ($this->getParent()?->getSalleEvents()->count()) {return $this->salleEvents->count() ? $this->salleEvents : $this->getParent()?->getSalleEvents();}return $this->salleEvents;}/*** @return Collection<int, Emargement>*/public function getEmargements(): Collection{return $this->emargements;}public function addEmargement(Emargement $emargement): self{if (!$this->emargements->contains($emargement)) {$this->emargements->add($emargement);$emargement->setEvent($this);}return $this;}public function removeEmargement(Emargement $emargement): self{// set the owning side to null (unless already changed)if ($this->emargements->removeElement($emargement) && $emargement->getEvent() === $this) {$emargement->setEvent(null);}return $this;}public function getTitle(): string{$title = $this->getId();if ($this->getModule()?->getIntitule()) {$title = $this->getModule()?->getFullIntituleType()??"";}if (($this->getAccompagnementOrParentAccompagnement()?->getType()?->getDesignation() ?? "") !== '' &&($this->getAccompagnementOrParentAccompagnement()?->getType()?->getDesignation() ?? "") !== '0') {$title = $this->getAccompagnementOrParentAccompagnement()?->getType()?->getDesignation()??"";}if ($this->getStage() instanceof Stage) {$title = "Stage" ;}if ($this->getJury() instanceof Jury) {$title = "Jury";}return $title;}public function getCode(): string{return $this->getModule()?->getCode() ?? ""?? $this->getAccompagnementOrParentAccompagnement()?->getType()?->getCode()?? "" ?? $this->getJury()?->getParcours()?->getCode() ?? "";}public function getSendconvocationstagiaire(): ?bool{return $this->sendconvocationstagiaire;}public function setSendconvocationstagiaire(?bool $sendconvocationstagiaire): self{$this->sendconvocationstagiaire = $sendconvocationstagiaire;return $this;}public function getSendconvocationformateur(): ?bool{return $this->sendconvocationformateur;}public function setSendconvocationformateur(?bool $sendconvocationformateur): self{$this->sendconvocationformateur = $sendconvocationformateur;return $this;}public function getType(): ?string{$type = $this->getId();if ($this->getModule() instanceof Module) {$type ="Module" ;}if ($this->getAccompagnementOrParentAccompagnement() instanceof Accompagnement) {$type ="Accompagnement" ;}if ($this->getStage() instanceof Stage) {$type = "Stage" ;}if ($this->getJury() instanceof Jury) {$type = "Jury";}return $type;}public function isTempsPriseEnCompte(): bool{return $this->tempsPriseEnCompte;}public function setTempsPriseEnCompte(bool $tempsPriseEnCompte): self{$this->tempsPriseEnCompte = $tempsPriseEnCompte;return $this;}public function isJustFinished(): bool{$now = new \DateTime();return$now->format('H') === '17'&& $this->getEnd()?->format('Y-m-d') === $now->format('Y-m-d');}public function isSendconvocationstagiaire(): ?bool{return $this->sendconvocationstagiaire;}public function isSendconvocationformateur(): ?bool{return $this->sendconvocationformateur;}/*** @return Collection<int, FormulaireEvent>*/public function getFormulaireEvents(): Collection{return $this->formulaireEvents;}public function addFormulaireEvent(FormulaireEvent $formulaireEvent): static{if (!$this->formulaireEvents->contains($formulaireEvent)) {$this->formulaireEvents->add($formulaireEvent);$formulaireEvent->setEvent($this);}return $this;}public function removeFormulaireEvent(FormulaireEvent $formulaireEvent): static{if ($this->formulaireEvents->removeElement($formulaireEvent)) {// set the owning side to null (unless already changed)if ($formulaireEvent->getEvent() === $this) {$formulaireEvent->setEvent(null);}}return $this;}}