src/Entity/BookingUserGroup.php line 11

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