<?php
namespace App\Entity\Gallery;
use App\Repository\Gallery\CollectionGalleryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: CollectionGalleryRepository::class)]
class CollectionGallery
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column]
private ?bool $is_activ = null;
#[ORM\ManyToMany(targetEntity: Gallery::class, inversedBy: 'collectionGalleries', cascade: ['persist'])]
private Collection $gallery;
public function __construct()
{
$this->gallery = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function isIsActiv(): ?bool
{
return $this->is_activ;
}
public function setIsActiv(bool $is_activ): self
{
$this->is_activ = $is_activ;
return $this;
}
/**
* @return Collection<int, Gallery>
*/
public function getGallery(): Collection
{
return $this->gallery;
}
public function addGallery(Gallery $gallery): self
{
if (!$this->gallery->contains($gallery)) {
$this->gallery->add($gallery);
}
return $this;
}
public function removeGallery(Gallery $gallery): self
{
$this->gallery->removeElement($gallery);
return $this;
}
}