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

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