src/Entity/BookingEventAddressCategory.php line 11

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