src/Entity/Gestiform/Formations/Session/SalleEvent.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gestiform\Formations\Session;
  3. use App\Entity\AbstractEntity;
  4. use App\Entity\Gestiform\Admin\Salle;
  5. use App\Entity\Gestiform\Formations\Session\Planning\Event;
  6. use App\Entity\Gestiform\Formations\Session\Planning\PlanningEvent;
  7. use App\Repository\Gestiform\Formations\Session\SalleEventRepository;
  8. use Doctrine\Common\Collections\ArrayCollection;
  9. use Doctrine\Common\Collections\Collection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. /**
  12.  * @ORM\Entity(repositoryClass=SalleEventRepository::class)
  13.  */
  14. class SalleEvent extends AbstractEntity
  15. {
  16.     /**
  17.      * @ORM\ManyToOne(targetEntity=Salle::class, inversedBy="salleEvents")
  18.      * @ORM\JoinColumn(nullable=false)
  19.      */
  20.     private Salle $salle;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity=Event::class, inversedBy="salleEvents")
  23.      * @ORM\JoinColumn(nullable=false)
  24.      */
  25.     private Event $event;
  26.     /**
  27.      * @ORM\OneToMany(targetEntity=PlanningEvent::class, mappedBy="salleEvent")
  28.      */
  29.     private Collection $planningEvents;
  30.     public function __construct()
  31.     {
  32.         $this->planningEvents = new ArrayCollection();
  33.     }
  34.     public function getSalle(): Salle
  35.     {
  36.         return $this->salle;
  37.     }
  38.     public function setSalle(Salle $salle): self
  39.     {
  40.         $this->salle $salle;
  41.         return $this;
  42.     }
  43.     public function getEvent(): Event
  44.     {
  45.         return $this->event;
  46.     }
  47.     public function setEvent(Event $event): self
  48.     {
  49.         $this->event $event;
  50.         return $this;
  51.     }
  52.     public function getPlanningEvents(): Collection
  53.     {
  54.         return $this->planningEvents;
  55.     }
  56.     public function addPlanningEvent(PlanningEvent $planningEvent): self
  57.     {
  58.         if (!$this->planningEvents->contains($planningEvent)) {
  59.             $this->planningEvents[] = $planningEvent;
  60.             $planningEvent->setSalleEvent($this);
  61.         }
  62.         return $this;
  63.     }
  64.     public function removePlanningEvent(PlanningEvent $planningEvent): self
  65.     {
  66.         if ($this->planningEvents->removeElement($planningEvent)) {
  67.             // set the owning side to null (unless already changed)
  68.             if ($planningEvent->getSalleEvent() === $this) {
  69.                 $planningEvent->setSalleEvent(null);
  70.             }
  71.         }
  72.         return $this;
  73.     }
  74. }