<?phpnamespace App\Entity;use App\Repository\EventRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use DrosalysWeb\ObjectExtensions\Blame\Model\CreatedBlameInterface;use DrosalysWeb\ObjectExtensions\Blame\Model\CreatedBlameTrait;use DrosalysWeb\ObjectExtensions\Slug\Model\SlugInterface;use DrosalysWeb\ObjectExtensions\Slug\Model\SlugTrait;use DrosalysWeb\ObjectExtensions\Timestamp\Model\CreatedTimestampInterface;use DrosalysWeb\ObjectExtensions\Timestamp\Model\CreatedTimestampTrait;use Symfony\Component\Serializer\Annotation\Groups;#[ORM\Entity(repositoryClass: EventRepository::class)]class Event implements SlugInterface, CreatedTimestampInterface{ use SlugTrait; use CreatedTimestampTrait; #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] #[Groups(['paymentGroup', 'orderJsonData'])] private $id; #[ORM\Column(type: 'string', length: 255)] #[Groups(['paymentGroup', 'orderJsonData'])] private $title; #[ORM\Column(type: 'text')] private $description; #[ORM\Column(type: Types::DATETIME_MUTABLE)] #[Groups(['paymentGroup', 'orderJsonData'])] private ?\DateTimeInterface $startAt = null; #[ORM\OneToMany(mappedBy: 'relatedEvent', targetEntity: Ticket::class)] private Collection $tickets; #[ORM\Column(length: 255)] #[Groups(['paymentGroup'])] private ?string $poster = null; #[ORM\OneToMany(mappedBy: 'relatedEvent', targetEntity: Order::class)] private Collection $orders; public function __construct() { $this->tickets = new ArrayCollection(); $this->orders = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } public static function getSlugFields(): array { return ['title']; } public function getStartAt(): ?\DateTimeInterface { return $this->startAt; } public function setStartAt(\DateTimeInterface $startAt): self { $this->startAt = $startAt; return $this; } public function __toString(): string { return $this->title; } /** * @return Collection<int, Ticket> */ public function getTickets(): Collection { return $this->tickets; } public function addTicket(Ticket $ticket): self { if (!$this->tickets->contains($ticket)) { $this->tickets->add($ticket); $ticket->setRelatedEvent($this); } return $this; } public function removeTicket(Ticket $ticket): self { if ($this->tickets->removeElement($ticket)) { // set the owning side to null (unless already changed) if ($ticket->getRelatedEvent() === $this) { $ticket->setRelatedEvent(null); } } return $this; } public function getPoster(): ?string { return $this->poster; } public function setPoster(string $poster): self { $this->poster = $poster; return $this; } /** * @return Collection<int, Order> */ public function getOrders(): Collection { return $this->orders; } public function addOrder(Order $order): self { if (!$this->orders->contains($order)) { $this->orders->add($order); $order->setRelatedEvent($this); } return $this; } public function removeOrder(Order $order): self { if ($this->orders->removeElement($order)) { // set the owning side to null (unless already changed) if ($order->getRelatedEvent() === $this) { $order->setRelatedEvent(null); } } return $this; } }