src/Entity/Event.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EventRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Uid\Uuid;
  8. /**
  9.  * @ORM\Entity(repositoryClass=EventRepository::class)
  10.  */
  11. class Event
  12. {
  13.     const STATE_ACTIVE 'active';
  14.     const STATE_CANCEL 'cancel';
  15.     const STATE_ARCHIVED 'archived';
  16.     /**
  17.      * @ORM\Id
  18.      * @ORM\Column(type="uuid", unique=true)
  19.      */
  20.     private Uuid $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     private $name;
  25.     /**
  26.      * @ORM\Column(type="datetime_immutable")
  27.      */
  28.     private $startAt;
  29.     /**
  30.      * @ORM\Column(type="datetime_immutable")
  31.      */
  32.     private $endAt;
  33.     /**
  34.      * @ORM\Column(type="text", nullable=true)
  35.      */
  36.     private $description;
  37.     /**
  38.      * @ORM\Column(type="enumeventstate")
  39.      */
  40.     private string $state self::STATE_ACTIVE;
  41.     /**
  42.      * @ORM\OneToMany(targetEntity=TicketType::class, mappedBy="event", orphanRemoval=true)
  43.      */
  44.     private $ticketTypes;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity=UpgradeRule::class, mappedBy="event", orphanRemoval=true)
  47.      */
  48.     private $upgradeOptions;
  49.     /**
  50.      * @ORM\Column(type="integer", nullable=true)
  51.      */
  52.     private $ticketTailorEventId;
  53.     /**
  54.      * @ORM\ManyToMany(targetEntity=Sponsor::class, mappedBy="events")
  55.      */
  56.     private $sponsors;
  57.     /**
  58.      * @ORM\ManyToMany(targetEntity=Food::class, mappedBy="events")
  59.      */
  60.     private $food;
  61.     /**
  62.      * @ORM\Column(type="string", length=255, nullable=true)
  63.      */
  64.     private $ticketTailorUrl;
  65.     /**
  66.      * @ORM\Column(type="string", length=255)
  67.      */
  68.     private $slug;
  69.     /**
  70.      * @ORM\Column(type="text", nullable=true)
  71.      */
  72.     private $emdedRadioCode;
  73.     public function __construct()
  74.     {
  75.         $this->id Uuid::v4();
  76.         $this->ticketTypes = new ArrayCollection();
  77.         $this->upgradeOptions = new ArrayCollection();
  78.         $this->sponsors = new ArrayCollection();
  79.         $this->food = new ArrayCollection();
  80.         $this->stages = new ArrayCollection();
  81.     }
  82.     public function getId(): Uuid
  83.     {
  84.         return $this->id;
  85.     }
  86.     public function getName(): ?string
  87.     {
  88.         return $this->name;
  89.     }
  90.     public function setName(string $name): self
  91.     {
  92.         $this->name $name;
  93.         return $this;
  94.     }
  95.     public function getStartAt(): ?\DateTimeImmutable
  96.     {
  97.         return $this->startAt;
  98.     }
  99.     public function setStartAt(\DateTimeImmutable $startAt): self
  100.     {
  101.         $this->startAt $startAt;
  102.         return $this;
  103.     }
  104.     public function getEndAt(): ?\DateTimeImmutable
  105.     {
  106.         return $this->endAt;
  107.     }
  108.     public function setEndAt(\DateTimeImmutable $endAt): self
  109.     {
  110.         $this->endAt $endAt;
  111.         return $this;
  112.     }
  113.     public function getDescription(): ?string
  114.     {
  115.         return $this->description;
  116.     }
  117.     public function setDescription(?string $description): self
  118.     {
  119.         $this->description $description;
  120.         return $this;
  121.     }
  122.     public function getState(): ?string
  123.     {
  124.         return $this->state;
  125.     }
  126.     public function setState(string $state): self
  127.     {
  128.         $this->state $state;
  129.         return $this;
  130.     }
  131.     /**
  132.      * @return Collection|TicketType[]
  133.      */
  134.     public function getTicketTypes(): Collection
  135.     {
  136.         return $this->ticketTypes;
  137.     }
  138.     public function addTicketType(TicketType $ticketType): self
  139.     {
  140.         if (!$this->ticketTypes->contains($ticketType)) {
  141.             $this->ticketTypes[] = $ticketType;
  142.             $ticketType->setEvent($this);
  143.         }
  144.         return $this;
  145.     }
  146.     public function removeTicketType(TicketType $ticketType): self
  147.     {
  148.         if ($this->ticketTypes->removeElement($ticketType)) {
  149.             // set the owning side to null (unless already changed)
  150.             if ($ticketType->getEvent() === $this) {
  151.                 $ticketType->setEvent(null);
  152.             }
  153.         }
  154.         return $this;
  155.     }
  156.     /**
  157.      * @return Collection|UpgradeRule[]
  158.      */
  159.     public function getUpgradeOptions(): Collection
  160.     {
  161.         return $this->upgradeOptions;
  162.     }
  163.     public function addUpdgradeOption(UpgradeRule $upgradeOption): self
  164.     {
  165.         if (!$this->upgradeOptions->contains($upgradeOption)) {
  166.             $this->upgradeOptions[] = $upgradeOption;
  167.             $upgradeOption->setEvent($this);
  168.         }
  169.         return $this;
  170.     }
  171.     public function removeUpgradeOption(UpgradeRule $upgradeRule): self
  172.     {
  173.         if ($this->upgradeOptions->removeElement($upgradeRule)) {
  174.             // set the owning side to null (unless already changed)
  175.             if ($upgradeRule->getEvent() === $this) {
  176.                 $upgradeRule->setEvent(null);
  177.             }
  178.         }
  179.         return $this;
  180.     }
  181.     public function getTicketTailorEventId(): ?int
  182.     {
  183.         return $this->ticketTailorEventId;
  184.     }
  185.     public function setTicketTailorEventId(?int $ticketTailorEventId): self
  186.     {
  187.         $this->ticketTailorEventId $ticketTailorEventId;
  188.         return $this;
  189.     }
  190.     /**
  191.      * @return Collection<int, Sponsor>
  192.      */
  193.     public function getSponsors(): Collection
  194.     {
  195.         return $this->sponsors;
  196.     }
  197.     public function addSponsor(Sponsor $sponsor): self
  198.     {
  199.         if (!$this->sponsors->contains($sponsor)) {
  200.             $this->sponsors[] = $sponsor;
  201.             $sponsor->addEvent($this);
  202.         }
  203.         return $this;
  204.     }
  205.     public function removeSponsor(Sponsor $sponsor): self
  206.     {
  207.         if ($this->sponsors->removeElement($sponsor)) {
  208.             $sponsor->removeEvent($this);
  209.         }
  210.         return $this;
  211.     }
  212.     /**
  213.      * @return Collection<int, Food>
  214.      */
  215.     public function getFood(): Collection
  216.     {
  217.         return $this->food;
  218.     }
  219.     public function addFood(Food $food): self
  220.     {
  221.         if (!$this->food->contains($food)) {
  222.             $this->food[] = $food;
  223.             $food->addEvent($this);
  224.         }
  225.         return $this;
  226.     }
  227.     public function removeFood(Food $food): self
  228.     {
  229.         if ($this->food->removeElement($food)) {
  230.             $food->removeEvent($this);
  231.         }
  232.         return $this;
  233.     }
  234.     public function getTicketTailorUrl(): ?string
  235.     {
  236.         return $this->ticketTailorUrl;
  237.     }
  238.     public function setTicketTailorUrl(?string $ticketTailorUrl): self
  239.     {
  240.         $this->ticketTailorUrl $ticketTailorUrl;
  241.         return $this;
  242.     }
  243.     public function getSlug(): ?string
  244.     {
  245.         return $this->slug;
  246.     }
  247.     public function setSlug(string $slug): self
  248.     {
  249.         $this->slug $slug;
  250.         return $this;
  251.     }
  252.     public function getEmdedRadioCode(): ?string
  253.     {
  254.         return $this->emdedRadioCode;
  255.     }
  256.     public function setEmdedRadioCode(?string $emdedRadioCode): self
  257.     {
  258.         $this->emdedRadioCode $emdedRadioCode;
  259.         return $this;
  260.     }
  261. }