<?php
namespace App\Entity\Gestiform\Formations\Session;
use App\Entity\AbstractEntity;
use App\Entity\Gestiform\Admin\Salle;
use App\Entity\Gestiform\Formations\Session\Planning\Event;
use App\Entity\Gestiform\Formations\Session\Planning\PlanningEvent;
use App\Repository\Gestiform\Formations\Session\SalleEventRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=SalleEventRepository::class)
*/
class SalleEvent extends AbstractEntity
{
/**
* @ORM\ManyToOne(targetEntity=Salle::class, inversedBy="salleEvents")
* @ORM\JoinColumn(nullable=false)
*/
private Salle $salle;
/**
* @ORM\ManyToOne(targetEntity=Event::class, inversedBy="salleEvents")
* @ORM\JoinColumn(nullable=false)
*/
private Event $event;
/**
* @ORM\OneToMany(targetEntity=PlanningEvent::class, mappedBy="salleEvent")
*/
private Collection $planningEvents;
public function __construct()
{
$this->planningEvents = new ArrayCollection();
}
public function getSalle(): Salle
{
return $this->salle;
}
public function setSalle(Salle $salle): self
{
$this->salle = $salle;
return $this;
}
public function getEvent(): Event
{
return $this->event;
}
public function setEvent(Event $event): self
{
$this->event = $event;
return $this;
}
public function getPlanningEvents(): Collection
{
return $this->planningEvents;
}
public function addPlanningEvent(PlanningEvent $planningEvent): self
{
if (!$this->planningEvents->contains($planningEvent)) {
$this->planningEvents[] = $planningEvent;
$planningEvent->setSalleEvent($this);
}
return $this;
}
public function removePlanningEvent(PlanningEvent $planningEvent): self
{
if ($this->planningEvents->removeElement($planningEvent)) {
// set the owning side to null (unless already changed)
if ($planningEvent->getSalleEvent() === $this) {
$planningEvent->setSalleEvent(null);
}
}
return $this;
}
}