src/Entity/Gallery/CollectionGallery.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gallery;
  3. use App\Repository\Gallery\CollectionGalleryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassCollectionGalleryRepository::class)]
  8. class CollectionGallery
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $name null;
  16.     #[ORM\Column]
  17.     private ?bool $is_activ null;
  18.     #[ORM\ManyToMany(targetEntityGallery::class, inversedBy'collectionGalleries'cascade: ['persist'])]
  19.     private Collection $gallery;
  20.     public function __construct()
  21.     {
  22.         $this->gallery = new ArrayCollection();
  23.     }
  24.     public function getId(): ?int
  25.     {
  26.         return $this->id;
  27.     }
  28.     public function getName(): ?string
  29.     {
  30.         return $this->name;
  31.     }
  32.     public function setName(string $name): self
  33.     {
  34.         $this->name $name;
  35.         return $this;
  36.     }
  37.     public function isIsActiv(): ?bool
  38.     {
  39.         return $this->is_activ;
  40.     }
  41.     public function setIsActiv(bool $is_activ): self
  42.     {
  43.         $this->is_activ $is_activ;
  44.         return $this;
  45.     }
  46.     /**
  47.      * @return Collection<int, Gallery>
  48.      */
  49.     public function getGallery(): Collection
  50.     {
  51.         return $this->gallery;
  52.     }
  53.     public function addGallery(Gallery $gallery): self
  54.     {
  55.         if (!$this->gallery->contains($gallery)) {
  56.             $this->gallery->add($gallery);
  57.         }
  58.         return $this;
  59.     }
  60.     public function removeGallery(Gallery $gallery): self
  61.     {
  62.         $this->gallery->removeElement($gallery);
  63.         return $this;
  64.     }
  65. }