src/Entity/Gestiform/Formations/Session/Planning/Event.php line 20

  1. <?php
  2. namespace App\Entity\Gestiform\Formations\Session\Planning;
  3. ;
  4. use DateTime;
  5. use App\Entity\AbstractEntity;
  6. use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;
  7. use App\Entity\Gestiform\Formations\Emargement\Emargement;
  8. use App\Entity\Gestiform\Formations\Session\FormateurEvent;
  9. use App\Entity\Gestiform\Formations\Catalogue\Module\Module;
  10. use App\Entity\Gestiform\Formations\Session\SalleEvent;
  11. use App\Entity\Gestiform\Formations\Session\SessionBlocModule;
  12. use App\Repository\Gestiform\Formations\Session\Planning\EventRepository;
  13. use Doctrine\Common\Collections\ArrayCollection;
  14. use Doctrine\Common\Collections\Collection;
  15. use Doctrine\ORM\Mapping as ORM;
  16. #[ORM\Entity(repositoryClassEventRepository::class)]
  17. class Event extends AbstractEntity
  18. {
  19.     #[ORM\Column(type'datetime')]
  20.     private DateTime $start;
  21.     #[ORM\Column(type'datetime')]
  22.     private ?DateTime $end null;
  23.     #[ORM\Column(type'integer')]
  24.     private int $hours;
  25.     #[ORM\JoinColumn(nullabletrue)]
  26.     #[ORM\ManyToOne(targetEntityMasterlistelg::class)]
  27.     private ?Masterlistelg $modalite null;
  28.     #[ORM\ManyToOne(targetEntityEvent::class, inversedBy'children')]
  29.     private ?Event $parent null;
  30.     #[ORM\OneToMany(mappedBy'parent'targetEntityEvent::class, cascade: ['persist''remove'])]
  31.     private Collection $children;
  32.     #[ORM\OneToMany(mappedBy'event'targetEntityPlanningEvent::class, cascade: ['persist''remove'])]
  33.     private Collection $planningEvents;
  34.     #[ORM\ManyToOne(targetEntitySessionBlocModule::class, inversedBy'events')]
  35.     private ?SessionBlocModule $sessionBlocModule null;
  36.     #[ORM\ManyToOne(targetEntityAccompagnement::class, cascade: ['persist'], inversedBy'events')]
  37.     private ?Accompagnement $accompagnement null;
  38.     #[ORM\ManyToOne(targetEntityModule::class, cascade: ['persist'], inversedBy'events')]
  39.     private ?Module $module null;
  40.     #[ORM\ManyToOne(targetEntityJury::class, cascade: ['persist'], inversedBy'events')]
  41.     private ?Jury $jury null;
  42.     #[ORM\ManyToOne(targetEntityStage::class, cascade: ['persist'], inversedBy'events')]
  43.     private ?Stage $stage null;
  44.     #[ORM\OneToMany(mappedBy'evenement'targetEntityFormateurEvent::class, cascade: ['persist''remove'])]
  45.     private Collection $formateurEvents;
  46.     #[ORM\OneToMany(mappedBy'event'targetEntitySalleEvent::class, cascade: ['persist''remove'])]
  47.     private Collection $salleEvents;
  48.     #[ORM\OneToMany(mappedBy'event'targetEntityEmargement::class, cascade: ['persist''remove'])]
  49.     private Collection $emargements;
  50.     #[ORM\Column(type'boolean'nullabletrue)]
  51.     private ?bool $sendconvocationstagiaire false;
  52.     #[ORM\Column(type'boolean'nullabletrue)]
  53.     private ?bool $sendconvocationformateur false;
  54.     #[ORM\Column(type'boolean')]
  55.     private bool $tempsPriseEnCompte true;
  56.     
  57.     public function __construct()
  58.     {
  59.         $this->children = new ArrayCollection();
  60.         $this->planningEvents = new ArrayCollection();
  61.         $this->salleEvents = new ArrayCollection();
  62.         $this->formateurEvents = new ArrayCollection();
  63.         $this->emargements = new ArrayCollection();
  64.     }
  65.     public function getStart(): ?DateTime
  66.     {
  67.         return $this->start;
  68.     }
  69.     public function setStart(DateTime $start): self
  70.     {
  71.         $this->start $start;
  72.         return $this;
  73.     }
  74.     public function getEnd(): ?DateTime
  75.     {
  76.         return $this->end;
  77.     }
  78.     public function setEnd(?DateTime $end): self
  79.     {
  80.         $this->end $end;
  81.         return $this;
  82.     }
  83.     public function getModalite(): ?Masterlistelg
  84.     {
  85.         return $this->modalite;
  86.     }
  87.     public function getModaliteOrParentModalite(): ?Masterlistelg
  88.     {
  89.         return $this->modalite ?? $this->getParent()?->getModalite();
  90.     }
  91.     public function setModalite(?Masterlistelg $modalite): self
  92.     {
  93.         $this->modalite $modalite;
  94.         return $this;
  95.     }
  96.     public function getPlanningEvents(): Collection
  97.     {
  98.         return $this->planningEvents;
  99.     }
  100.     public function addPlanningEvent(PlanningEvent $planningEvent): self
  101.     {
  102.         if (!$this->planningEvents->contains($planningEvent)) {
  103.             $this->planningEvents[] = $planningEvent;
  104.             $planningEvent->setEvent($this);
  105.         }
  106.         return $this;
  107.     }
  108.     public function removePlanningEvent(PlanningEvent $planningEvent): self
  109.     {
  110.         $this->planningEvents->removeElement($planningEvent);
  111.         return $this;
  112.     }
  113.     public function getParent(): ?self
  114.     {
  115.         return $this->parent;
  116.     }
  117.     public function setParent(?self $parent): self
  118.     {
  119.         $this->parent $parent;
  120.         return $this;
  121.     }
  122.     /**
  123.      * @return Collection<int, self>
  124.      */
  125.     public function getChildren(): Collection
  126.     {
  127.         return $this->children;
  128.     }
  129.     public function setChildren(Collection $children): self
  130.     {
  131.         $this->children $children;
  132.         return $this;
  133.     }
  134.     public function addChild(self $child): self
  135.     {
  136.         if (!$this->children->contains($child)) {
  137.             $this->children[] = $child;
  138.             $child->setParent($this);
  139.         }
  140.         return $this;
  141.     }
  142.     public function removeChild(self $child): self
  143.     {
  144.         // set the owning side to null (unless already changed)
  145.         if ($this->children->removeElement($child) && $child->getParent() === $this) {
  146.             $child->setParent(null);
  147.         }
  148.         return $this;
  149.     }
  150.     public function getSessionBlocModule(): ?SessionBlocModule
  151.     {
  152.         return $this->sessionBlocModule;
  153.     }
  154.     public function getSessionBlocModuleOrParentSessionBlocModule(): ?SessionBlocModule
  155.     {
  156.         return $this->sessionBlocModule ?? $this->getParent()?->getSessionBlocModule();
  157.     }
  158.     public function setSessionBlocModule(?SessionBlocModule $sessionBlocModule): self
  159.     {
  160.         $this->sessionBlocModule $sessionBlocModule;
  161.         return $this;
  162.     }
  163.     public function getAccompagnement(): ?Accompagnement
  164.     {
  165.         return $this->accompagnement;
  166.     }
  167.     public function getAccompagnementOrParentAccompagnement(): ?Accompagnement
  168.     {
  169.         return $this->accompagnement ?? $this->getParent()?->getAccompagnement();
  170.     }
  171.     public function setAccompagnement(?Accompagnement $accompagnement): self
  172.     {
  173.         $this->accompagnement $accompagnement;
  174.         return $this;
  175.     }
  176.     public function getModule(): ?Module
  177.     {
  178.         return $this->module;
  179.     }
  180.     public function getModuleOrParentModule(): ?Module
  181.     {
  182.         return $this->module ?? $this->getParent()?->getModule();
  183.     }
  184.     public function setModule(?Module $module): self
  185.     {
  186.         $this->module $module;
  187.         return $this;
  188.     }
  189.     public function getJury(): ?Jury
  190.     {
  191.         return $this->jury;
  192.     }
  193.     public function getJuryOrParentJury(): ?Jury
  194.     {
  195.         return $this->jury ?? $this->getParent()?->getJury();
  196.     }
  197.     public function setJury(?Jury $jury): self
  198.     {
  199.         $this->jury $jury;
  200.         return $this;
  201.     }
  202.     public function getStage(): ?Stage
  203.     {
  204.         return $this->stage;
  205.     }
  206.     public function getStageOrParentStage(): ?Stage
  207.     {
  208.         return $this->stage ?? $this->getParent()?->getStage();
  209.     }
  210.     public function setStage(?Stage $stage): self
  211.     {
  212.         $this->stage $stage;
  213.         return $this;
  214.     }
  215.     /**
  216.      * @return Collection<int, FormateurEvent>
  217.      */
  218.     public function getFormateurEvents(): Collection
  219.     {
  220.         return $this->formateurEvents;
  221.     }
  222.     public function addFormateurEvent(FormateurEvent $formateurEvent): self
  223.     {
  224.         if (!$this->formateurEvents->contains($formateurEvent)) {
  225.             $this->formateurEvents->add($formateurEvent);
  226.             $formateurEvent->setEvenement($this);
  227.         }
  228.         return $this;
  229.     }
  230.     public function removeFormateurEvent(FormateurEvent $formateurEvent): self
  231.     {
  232.         // set the owning side to null (unless already changed)
  233.         if ($this->formateurEvents->removeElement($formateurEvent) && $formateurEvent->getEvenement() === $this) {
  234.             $formateurEvent->setEvenement(null);
  235.         }
  236.         return $this;
  237.     }
  238.     public function getHours(): int
  239.     {
  240.         return $this->hours;
  241.     }
  242.     public function setHours(int $hours): self
  243.     {
  244.         $this->hours $hours;
  245.         return $this;
  246.     }
  247.     public function getSalleEvents(): Collection
  248.     {
  249.         return $this->salleEvents;
  250.     }
  251.     public function addSalleEvent(SalleEvent $salleEvent): self
  252.     {
  253.         if (!$this->salleEvents->contains($salleEvent)) {
  254.             $this->salleEvents->add($salleEvent);
  255.         }
  256.         return $this;
  257.     }
  258.     public function removeSalleEvent(SalleEvent $salleEvent): self
  259.     {
  260.         $this->salleEvents->removeElement($salleEvent);
  261.         return $this;
  262.     }
  263.     public function getSalleEventOrParentSalleEvent(): Collection
  264.     {
  265.         if ($this->getParent()?->getSalleEvents()->count()) {
  266.             return $this->salleEvents->count() ? $this->salleEvents $this->getParent()?->getSalleEvents();
  267.         }
  268.         return $this->salleEvents;
  269.     }
  270.     /**
  271.      * @return Collection<int, Emargement>
  272.      */
  273.     public function getEmargements(): Collection
  274.     {
  275.         return $this->emargements;
  276.     }
  277.     public function addEmargement(Emargement $emargement): self
  278.     {
  279.         if (!$this->emargements->contains($emargement)) {
  280.             $this->emargements->add($emargement);
  281.             $emargement->setEvent($this);
  282.         }
  283.         return $this;
  284.     }
  285.     public function removeEmargement(Emargement $emargement): self
  286.     {
  287.         // set the owning side to null (unless already changed)
  288.         if ($this->emargements->removeElement($emargement) && $emargement->getEvent() === $this) {
  289.             $emargement->setEvent(null);
  290.         }
  291.         return $this;
  292.     }
  293.     public function getTitle(): string
  294.     {
  295.         $title $this->getId();
  296.         if ($this->getModule()?->getIntitule()) {
  297.             $title $this->getModule()?->getFullIntituleType()??"";
  298.         }
  299.         if (($this->getAccompagnementOrParentAccompagnement()?->getType()?->getDesignation() ?? "") !== '' && ($this->getAccompagnementOrParentAccompagnement()?->getType()?->getDesignation() ?? "") !== '0') {
  300.             $title $this->getAccompagnementOrParentAccompagnement()?->getType()?->getDesignation()??"";
  301.         }
  302.         if ($this->getStage() instanceof \App\Entity\Gestiform\Formations\Session\Planning\Stage) {
  303.             $title "Stage" ;
  304.         }
  305.         if ($this->getJury() instanceof \App\Entity\Gestiform\Formations\Session\Planning\Jury) {
  306.             $title "Jury";
  307.         }
  308.         return $title;
  309.     }
  310.     public function getCode(): string
  311.     {
  312.         return $this->getModule()?->getCode() ?? ""
  313.             ?? $this->getAccompagnementOrParentAccompagnement()?->getType()?->getCode()
  314.             ?? "" ?? $this->getJury()?->getParcours()?->getCode() ?? "";
  315.     }
  316.     public function getSendconvocationstagiaire(): ?bool
  317.     {
  318.         return $this->sendconvocationstagiaire;
  319.     }
  320.     public function setSendconvocationstagiaire(?bool $sendconvocationstagiaire): self
  321.     {
  322.         $this->sendconvocationstagiaire $sendconvocationstagiaire;
  323.         return $this;
  324.     }
  325.     public function getSendconvocationformateur(): ?bool
  326.     {
  327.         return $this->sendconvocationformateur;
  328.     }
  329.     public function setSendconvocationformateur(?bool $sendconvocationformateur): self
  330.     {
  331.         $this->sendconvocationformateur $sendconvocationformateur;
  332.         return $this;
  333.     }
  334.     public function getType(): ?string
  335.     {
  336.         $type $this->getId();
  337.         if ($this->getModule() instanceof \App\Entity\Gestiform\Formations\Catalogue\Module\Module) {
  338.             $type ="Module" ;
  339.         }
  340.         if ($this->getAccompagnementOrParentAccompagnement() instanceof \App\Entity\Gestiform\Formations\Session\Planning\Accompagnement) {
  341.             $type ="Accompagnement" ;
  342.         }
  343.         if ($this->getStage() instanceof \App\Entity\Gestiform\Formations\Session\Planning\Stage) {
  344.             $type "Stage" ;
  345.         }
  346.         if ($this->getJury() instanceof \App\Entity\Gestiform\Formations\Session\Planning\Jury) {
  347.             $type "Jury";
  348.         }
  349.         return $type;
  350.     }
  351.     public function isTempsPriseEnCompte(): bool
  352.     {
  353.         return $this->tempsPriseEnCompte;
  354.     }
  355.     public function setTempsPriseEnCompte(bool $tempsPriseEnCompte): self
  356.     {
  357.         $this->tempsPriseEnCompte $tempsPriseEnCompte;
  358.         return $this;
  359.     }
  360. }