<?php
namespace App\Entity;
use App\Repository\BlogPostGalleryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=BlogPostGalleryRepository::class)
*/
class BlogPostGallery
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $columns;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $hasPreview;
/**
* @ORM\OneToMany(targetEntity=BlogPostGalleryItem::class, mappedBy="gallery", orphanRemoval=true, cascade={"persist", "remove"})
*/
private $items;
/**
* @ORM\ManyToOne(targetEntity=BlogPost::class, inversedBy="galleries")
*/
private $blogPost;
/**
* @Gedmo\SortablePosition
* @ORM\Column(type="integer", nullable=true)
*/
private $position;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private $backgroundColor;
/**
* @ORM\Column(type="string", length=255, nullable=false)
*/
private $titleColor;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $title;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
public function __construct()
{
$this->items = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getColumns(): ?int
{
return $this->columns;
}
public function setColumns(?int $columns): self
{
$this->columns = $columns;
return $this;
}
public function hasPreview(): ?bool
{
return $this->hasPreview;
}
public function setHasPreview(?bool $hasPreview): self
{
$this->hasPreview = $hasPreview;
return $this;
}
/**
* @return Collection<int, BlogPostGalleryItem>
*/
public function getItems(): Collection
{
return $this->items;
}
public function addItem(BlogPostGalleryItem $item): self
{
if (!$this->items->contains($item)) {
$this->items[] = $item;
$item->setGallery($this);
}
return $this;
}
public function removeItem(BlogPostGalleryItem $item): self
{
if ($this->items->removeElement($item)) {
// set the owning side to null (unless already changed)
if ($item->getGallery() === $this) {
$item->setGallery(null);
}
}
return $this;
}
public function getBlogPost(): ?BlogPost
{
return $this->blogPost;
}
public function setBlogPost(?BlogPost $blogPost): self
{
$this->blogPost = $blogPost;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = $position;
return $this;
}
public function getBackgroundColor(): string
{
return $this->backgroundColor;
}
public function setBackgroundColor(string $backgroundColor): self
{
$this->backgroundColor = $backgroundColor;
return $this;
}
public function getTitleColor(): string
{
return $this->titleColor;
}
public function setTitleColor(string $titleColor): self
{
$this->titleColor = $titleColor;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
}