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

  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. #[ORM\Entity(repositoryClassSalleEventRepository::class)]
  12. class SalleEvent extends AbstractEntity
  13. {
  14.     #[ORM\JoinColumn(nullablefalse)]
  15.     #[ORM\ManyToOne(targetEntitySalle::class, inversedBy'salleEvents')]
  16.     private Salle $salle;
  17.     #[ORM\JoinColumn(nullablefalse)]
  18.     #[ORM\ManyToOne(targetEntityEvent::class, inversedBy'salleEvents')]
  19.     private Event $event;
  20.     #[ORM\OneToMany(mappedBy'salleEvent'targetEntityPlanningEvent::class)]
  21.     private Collection $planningEvents;
  22.     public function __construct()
  23.     {
  24.         $this->planningEvents = new ArrayCollection();
  25.     }
  26.     public function getSalle(): Salle
  27.     {
  28.         return $this->salle;
  29.     }
  30.     public function setSalle(Salle $salle): self
  31.     {
  32.         $this->salle $salle;
  33.         return $this;
  34.     }
  35.     public function getEvent(): Event
  36.     {
  37.         return $this->event;
  38.     }
  39.     public function setEvent(Event $event): self
  40.     {
  41.         $this->event $event;
  42.         return $this;
  43.     }
  44.     public function getPlanningEvents(): Collection
  45.     {
  46.         return $this->planningEvents;
  47.     }
  48.     public function addPlanningEvent(PlanningEvent $planningEvent): self
  49.     {
  50.         if (!$this->planningEvents->contains($planningEvent)) {
  51.             $this->planningEvents[] = $planningEvent;
  52.             $planningEvent->setSalleEvent($this);
  53.         }
  54.         return $this;
  55.     }
  56.     public function removePlanningEvent(PlanningEvent $planningEvent): self
  57.     {
  58.         // set the owning side to null (unless already changed)
  59.         if ($this->planningEvents->removeElement($planningEvent) && $planningEvent->getSalleEvent() === $this) {
  60.             $planningEvent->setSalleEvent(null);
  61.         }
  62.         return $this;
  63.     }
  64. }