<?php
namespace App\Entity;
use App\Repository\CourRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CourRepository::class)]
class Cour
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne]
private ?Events $event = null;
#[ORM\Column(length: 50)]
private ?string $nom = null;
#[ORM\OneToMany(mappedBy: 'session', targetEntity: SerieBillet::class, cascade: ['persist', 'remove'])]
private Collection $serieBillets;
public function getId(): ?int
{
return $this->id;
}
public function getEvent(): ?Events
{
return $this->event;
}
public function setEvent(?Events $event): self
{
$this->event = $event;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
public function __toString()
{
return $this->getNom();
}
/**
* @return Collection<int, SerieBillet>
*/
public function getSerieBillets(): Collection
{
return $this->serieBillets;
}
public function addSerieBillet(SerieBillet $serieBillet): self
{
if (!$this->serieBillets->contains($serieBillet)) {
$this->serieBillets->add($serieBillet);
$serieBillet->setCour($this);
}
return $this;
}
public function removeSerieBillet(SerieBillet $serieBillet): self
{
if ($this->serieBillets->removeElement($serieBillet)) {
// set the owning side to null (unless already changed)
if ($serieBillet->getCour() === $this) {
$serieBillet->setCour(null);
}
}
return $this;
}
public function __clone(): void
{
if ($this->id) {
$this->id = null;
$this->event = null;
$this->serieBillets = new ArrayCollection();
}
}
}