src/Entity/BlogPostGallery.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BlogPostGalleryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass=BlogPostGalleryRepository::class)
  10.  */
  11. class BlogPostGallery
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="integer", nullable=true)
  21.      */
  22.     private $columns;
  23.     /**
  24.      * @ORM\Column(type="boolean", nullable=true)
  25.      */
  26.     private $hasPreview;
  27.     /**
  28.      * @ORM\OneToMany(targetEntity=BlogPostGalleryItem::class, mappedBy="gallery", orphanRemoval=true, cascade={"persist", "remove"})
  29.      */
  30.     private $items;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=BlogPost::class, inversedBy="galleries")
  33.      */
  34.     private $blogPost;
  35.     /**
  36.      * @Gedmo\SortablePosition
  37.      * @ORM\Column(type="integer", nullable=true)
  38.      */
  39.     private $position;
  40.     /**
  41.      * @ORM\Column(type="string", length=255, nullable=false)
  42.      */
  43.     private $backgroundColor;
  44.     /**
  45.      * @ORM\Column(type="string", length=255, nullable=false)
  46.      */
  47.     private $titleColor;
  48.     /**
  49.      * @ORM\Column(type="string", length=255, nullable=true)
  50.      */
  51.     private $title;
  52.     /**
  53.      * @ORM\Column(type="text", nullable=true)
  54.      */
  55.     private $description;
  56.     public function __construct()
  57.     {
  58.         $this->items = new ArrayCollection();
  59.     }
  60.     public function getId(): ?int
  61.     {
  62.         return $this->id;
  63.     }
  64.     public function getColumns(): ?int
  65.     {
  66.         return $this->columns;
  67.     }
  68.     public function setColumns(?int $columns): self
  69.     {
  70.         $this->columns $columns;
  71.         return $this;
  72.     }
  73.     
  74.     public function hasPreview(): ?bool
  75.     {
  76.         return $this->hasPreview;
  77.     }
  78.     public function setHasPreview(?bool $hasPreview): self
  79.     {
  80.         $this->hasPreview $hasPreview;
  81.         return $this;
  82.     }
  83.     /**
  84.      * @return Collection<int, BlogPostGalleryItem>
  85.      */
  86.     public function getItems(): Collection
  87.     {
  88.         return $this->items;
  89.     }
  90.     public function addItem(BlogPostGalleryItem $item): self
  91.     {
  92.         if (!$this->items->contains($item)) {
  93.             $this->items[] = $item;
  94.             $item->setGallery($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeItem(BlogPostGalleryItem $item): self
  99.     {
  100.         if ($this->items->removeElement($item)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($item->getGallery() === $this) {
  103.                 $item->setGallery(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     public function getBlogPost(): ?BlogPost
  109.     {
  110.         return $this->blogPost;
  111.     }
  112.     public function setBlogPost(?BlogPost $blogPost): self
  113.     {
  114.         $this->blogPost $blogPost;
  115.         return $this;
  116.     }
  117.     public function getPosition(): ?int
  118.     {
  119.         return $this->position;
  120.     }
  121.     public function setPosition(?int $position): self
  122.     {
  123.         $this->position $position;
  124.         return $this;
  125.     }
  126.     public function getBackgroundColor(): string
  127.     {
  128.         return $this->backgroundColor;
  129.     }
  130.     public function setBackgroundColor(string $backgroundColor): self
  131.     {
  132.         $this->backgroundColor $backgroundColor;
  133.         return $this;
  134.     }
  135.     public function getTitleColor(): string
  136.     {
  137.         return $this->titleColor;
  138.     }
  139.     public function setTitleColor(string $titleColor): self
  140.     {
  141.         $this->titleColor $titleColor;
  142.         return $this;
  143.     }
  144.     public function getTitle(): ?string
  145.     {
  146.         return $this->title;
  147.     }
  148.     public function setTitle(?string $title): self
  149.     {
  150.         $this->title $title;
  151.         return $this;
  152.     }
  153.     public function getDescription(): ?string
  154.     {
  155.         return $this->description;
  156.     }
  157.     public function setDescription(?string $description): self
  158.     {
  159.         $this->description $description;
  160.         return $this;
  161.     }
  162. }