src/Entity/Event.php line 19

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\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use DrosalysWeb\ObjectExtensions\Blame\Model\CreatedBlameInterface;
  9. use DrosalysWeb\ObjectExtensions\Blame\Model\CreatedBlameTrait;
  10. use DrosalysWeb\ObjectExtensions\Slug\Model\SlugInterface;
  11. use DrosalysWeb\ObjectExtensions\Slug\Model\SlugTrait;
  12. use DrosalysWeb\ObjectExtensions\Timestamp\Model\CreatedTimestampInterface;
  13. use DrosalysWeb\ObjectExtensions\Timestamp\Model\CreatedTimestampTrait;
  14. use Symfony\Component\Serializer\Annotation\Groups;
  15. #[ORM\Entity(repositoryClassEventRepository::class)]
  16. class Event implements SlugInterfaceCreatedTimestampInterface
  17. {
  18.     use SlugTrait;
  19.     use CreatedTimestampTrait;
  20.     #[ORM\Id]
  21.     #[ORM\GeneratedValue]
  22.     #[ORM\Column(type'integer')]
  23.     #[Groups(['paymentGroup''orderJsonData'])]
  24.     private $id;
  25.     #[ORM\Column(type'string'length255)]
  26.     #[Groups(['paymentGroup''orderJsonData'])]
  27.     private $title;
  28.     #[ORM\Column(type'text')]
  29.     private $description;
  30.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  31.     #[Groups(['paymentGroup''orderJsonData'])]
  32.     private ?\DateTimeInterface $startAt null;
  33.     #[ORM\OneToMany(mappedBy'relatedEvent'targetEntityTicket::class)]
  34.     private Collection $tickets;
  35.     #[ORM\Column(length255)]
  36.     #[Groups(['paymentGroup'])]
  37.     private ?string $poster null;
  38.     #[ORM\OneToMany(mappedBy'relatedEvent'targetEntityOrder::class)]
  39.     private Collection $orders;
  40.     public function __construct()
  41.     {
  42.         $this->tickets = new ArrayCollection();
  43.         $this->orders = new ArrayCollection();
  44.     }
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getTitle(): ?string
  50.     {
  51.         return $this->title;
  52.     }
  53.     public function setTitle(string $title): self
  54.     {
  55.         $this->title $title;
  56.         return $this;
  57.     }
  58.     public function getDescription(): ?string
  59.     {
  60.         return $this->description;
  61.     }
  62.     public function setDescription(string $description): self
  63.     {
  64.         $this->description $description;
  65.         return $this;
  66.     }
  67.     public static function getSlugFields(): array
  68.     {
  69.         return ['title'];
  70.     }
  71.     public function getStartAt(): ?\DateTimeInterface
  72.     {
  73.         return $this->startAt;
  74.     }
  75.     public function setStartAt(\DateTimeInterface $startAt): self
  76.     {
  77.         $this->startAt $startAt;
  78.         return $this;
  79.     }
  80.     public function __toString(): string
  81.     {
  82.         return $this->title;
  83.     }
  84.     /**
  85.      * @return Collection<int, Ticket>
  86.      */
  87.     public function getTickets(): Collection
  88.     {
  89.         return $this->tickets;
  90.     }
  91.     public function addTicket(Ticket $ticket): self
  92.     {
  93.         if (!$this->tickets->contains($ticket)) {
  94.             $this->tickets->add($ticket);
  95.             $ticket->setRelatedEvent($this);
  96.         }
  97.         return $this;
  98.     }
  99.     public function removeTicket(Ticket $ticket): self
  100.     {
  101.         if ($this->tickets->removeElement($ticket)) {
  102.             // set the owning side to null (unless already changed)
  103.             if ($ticket->getRelatedEvent() === $this) {
  104.                 $ticket->setRelatedEvent(null);
  105.             }
  106.         }
  107.         return $this;
  108.     }
  109.     public function getPoster(): ?string
  110.     {
  111.         return $this->poster;
  112.     }
  113.     public function setPoster(string $poster): self
  114.     {
  115.         $this->poster $poster;
  116.         return $this;
  117.     }
  118.     /**
  119.      * @return Collection<int, Order>
  120.      */
  121.     public function getOrders(): Collection
  122.     {
  123.         return $this->orders;
  124.     }
  125.     public function addOrder(Order $order): self
  126.     {
  127.         if (!$this->orders->contains($order)) {
  128.             $this->orders->add($order);
  129.             $order->setRelatedEvent($this);
  130.         }
  131.         return $this;
  132.     }
  133.     public function removeOrder(Order $order): self
  134.     {
  135.         if ($this->orders->removeElement($order)) {
  136.             // set the owning side to null (unless already changed)
  137.             if ($order->getRelatedEvent() === $this) {
  138.                 $order->setRelatedEvent(null);
  139.             }
  140.         }
  141.         return $this;
  142.     }
  143.     
  144. }