<?php
namespace App\Entity;
use App\Repository\EventRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Uid\Uuid;
/**
* @ORM\Entity(repositoryClass=EventRepository::class)
*/
class Event
{
const STATE_ACTIVE = 'active';
const STATE_CANCEL = 'cancel';
const STATE_ARCHIVED = 'archived';
/**
* @ORM\Id
* @ORM\Column(type="uuid", unique=true)
*/
private Uuid $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $startAt;
/**
* @ORM\Column(type="datetime_immutable")
*/
private $endAt;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="enumeventstate")
*/
private string $state = self::STATE_ACTIVE;
/**
* @ORM\OneToMany(targetEntity=TicketType::class, mappedBy="event", orphanRemoval=true)
*/
private $ticketTypes;
/**
* @ORM\OneToMany(targetEntity=UpgradeRule::class, mappedBy="event", orphanRemoval=true)
*/
private $upgradeOptions;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $ticketTailorEventId;
/**
* @ORM\ManyToMany(targetEntity=Sponsor::class, mappedBy="events")
*/
private $sponsors;
/**
* @ORM\ManyToMany(targetEntity=Food::class, mappedBy="events")
*/
private $food;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $ticketTailorUrl;
/**
* @ORM\Column(type="string", length=255)
*/
private $slug;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $emdedRadioCode;
public function __construct()
{
$this->id = Uuid::v4();
$this->ticketTypes = new ArrayCollection();
$this->upgradeOptions = new ArrayCollection();
$this->sponsors = new ArrayCollection();
$this->food = new ArrayCollection();
$this->stages = new ArrayCollection();
}
public function getId(): Uuid
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getStartAt(): ?\DateTimeImmutable
{
return $this->startAt;
}
public function setStartAt(\DateTimeImmutable $startAt): self
{
$this->startAt = $startAt;
return $this;
}
public function getEndAt(): ?\DateTimeImmutable
{
return $this->endAt;
}
public function setEndAt(\DateTimeImmutable $endAt): self
{
$this->endAt = $endAt;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getState(): ?string
{
return $this->state;
}
public function setState(string $state): self
{
$this->state = $state;
return $this;
}
/**
* @return Collection|TicketType[]
*/
public function getTicketTypes(): Collection
{
return $this->ticketTypes;
}
public function addTicketType(TicketType $ticketType): self
{
if (!$this->ticketTypes->contains($ticketType)) {
$this->ticketTypes[] = $ticketType;
$ticketType->setEvent($this);
}
return $this;
}
public function removeTicketType(TicketType $ticketType): self
{
if ($this->ticketTypes->removeElement($ticketType)) {
// set the owning side to null (unless already changed)
if ($ticketType->getEvent() === $this) {
$ticketType->setEvent(null);
}
}
return $this;
}
/**
* @return Collection|UpgradeRule[]
*/
public function getUpgradeOptions(): Collection
{
return $this->upgradeOptions;
}
public function addUpdgradeOption(UpgradeRule $upgradeOption): self
{
if (!$this->upgradeOptions->contains($upgradeOption)) {
$this->upgradeOptions[] = $upgradeOption;
$upgradeOption->setEvent($this);
}
return $this;
}
public function removeUpgradeOption(UpgradeRule $upgradeRule): self
{
if ($this->upgradeOptions->removeElement($upgradeRule)) {
// set the owning side to null (unless already changed)
if ($upgradeRule->getEvent() === $this) {
$upgradeRule->setEvent(null);
}
}
return $this;
}
public function getTicketTailorEventId(): ?int
{
return $this->ticketTailorEventId;
}
public function setTicketTailorEventId(?int $ticketTailorEventId): self
{
$this->ticketTailorEventId = $ticketTailorEventId;
return $this;
}
/**
* @return Collection<int, Sponsor>
*/
public function getSponsors(): Collection
{
return $this->sponsors;
}
public function addSponsor(Sponsor $sponsor): self
{
if (!$this->sponsors->contains($sponsor)) {
$this->sponsors[] = $sponsor;
$sponsor->addEvent($this);
}
return $this;
}
public function removeSponsor(Sponsor $sponsor): self
{
if ($this->sponsors->removeElement($sponsor)) {
$sponsor->removeEvent($this);
}
return $this;
}
/**
* @return Collection<int, Food>
*/
public function getFood(): Collection
{
return $this->food;
}
public function addFood(Food $food): self
{
if (!$this->food->contains($food)) {
$this->food[] = $food;
$food->addEvent($this);
}
return $this;
}
public function removeFood(Food $food): self
{
if ($this->food->removeElement($food)) {
$food->removeEvent($this);
}
return $this;
}
public function getTicketTailorUrl(): ?string
{
return $this->ticketTailorUrl;
}
public function setTicketTailorUrl(?string $ticketTailorUrl): self
{
$this->ticketTailorUrl = $ticketTailorUrl;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getEmdedRadioCode(): ?string
{
return $this->emdedRadioCode;
}
public function setEmdedRadioCode(?string $emdedRadioCode): self
{
$this->emdedRadioCode = $emdedRadioCode;
return $this;
}
}