<?php
namespace App\Entity;
use App\Repository\BookingEventCategoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BookingEventCategoryRepository::class)]
class BookingEventCategory
{
use IdentifiableTrait;
#[ORM\Column(length: 50)]
private ?string $name = null;
#[ORM\Column(length: 50)]
private ?string $slug = null;
#[ORM\OneToMany(mappedBy: 'eventCategory', targetEntity: BookingEvent::class)]
private Collection $bookingEvents;
public function __construct()
{
$this->bookingEvents = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): static
{
$this->slug = $slug;
return $this;
}
/**
* @return Collection<int, BookingEvent>
*/
public function getBookingEvents(): Collection
{
return $this->bookingEvents;
}
public function addBookingEvent(BookingEvent $bookingEvent): static
{
if (!$this->bookingEvents->contains($bookingEvent)) {
$this->bookingEvents->add($bookingEvent);
$bookingEvent->setEventCategory($this);
}
return $this;
}
public function removeBookingEvent(BookingEvent $bookingEvent): static
{
if ($this->bookingEvents->removeElement($bookingEvent)) {
// set the owning side to null (unless already changed)
if ($bookingEvent->getEventCategory() === $this) {
$bookingEvent->setEventCategory(null);
}
}
return $this;
}
}