src/Entity/BookingEventCategory.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BookingEventCategoryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassBookingEventCategoryRepository::class)]
  8. class BookingEventCategory
  9. {
  10.     use IdentifiableTrait;
  11.     #[ORM\Column(length50)]
  12.     private ?string $name null;
  13.     #[ORM\Column(length50)]
  14.     private ?string $slug null;
  15.     #[ORM\OneToMany(mappedBy'eventCategory'targetEntityBookingEvent::class)]
  16.     private Collection $bookingEvents;
  17.     public function __construct()
  18.     {
  19.         $this->bookingEvents = new ArrayCollection();
  20.     }
  21.     public function getId(): ?int
  22.     {
  23.         return $this->id;
  24.     }
  25.     public function getName(): ?string
  26.     {
  27.         return $this->name;
  28.     }
  29.     public function setName(string $name): static
  30.     {
  31.         $this->name $name;
  32.         return $this;
  33.     }
  34.     public function getSlug(): ?string
  35.     {
  36.         return $this->slug;
  37.     }
  38.     public function setSlug(string $slug): static
  39.     {
  40.         $this->slug $slug;
  41.         return $this;
  42.     }
  43.     /**
  44.      * @return Collection<int, BookingEvent>
  45.      */
  46.     public function getBookingEvents(): Collection
  47.     {
  48.         return $this->bookingEvents;
  49.     }
  50.     public function addBookingEvent(BookingEvent $bookingEvent): static
  51.     {
  52.         if (!$this->bookingEvents->contains($bookingEvent)) {
  53.             $this->bookingEvents->add($bookingEvent);
  54.             $bookingEvent->setEventCategory($this);
  55.         }
  56.         return $this;
  57.     }
  58.     public function removeBookingEvent(BookingEvent $bookingEvent): static
  59.     {
  60.         if ($this->bookingEvents->removeElement($bookingEvent)) {
  61.             // set the owning side to null (unless already changed)
  62.             if ($bookingEvent->getEventCategory() === $this) {
  63.                 $bookingEvent->setEventCategory(null);
  64.             }
  65.         }
  66.         return $this;
  67.     }
  68. }