src/Entity/BookingMethod.php line 11

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