<?php
namespace App\Entity;
use App\Repository\ProductPageRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ProductPageRepository::class)
*/
class ProductPage
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $slug;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $document;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $benefit;
/**
* @ORM\OneToMany(targetEntity=Image::class, mappedBy="productPage", cascade={"persist", "remove"})
*/
private $images;
/**
* @ORM\ManyToOne(targetEntity=SubCategory::class, inversedBy="productPages")
*/
private $subCategory;
public function __construct()
{
$this->images = 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 getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDocument()
{
return $this->document;
}
public function setDocument($document)
{
$this->document = $document;
return $this;
}
public function getBenefit(): ?string
{
return $this->benefit;
}
public function setBenefit(?string $benefit): self
{
$this->benefit = $benefit;
return $this;
}
/**
* @return Collection<int, Image>
*/
public function getImages(): Collection
{
return $this->images;
}
public function addImage(Image $image): self
{
if (!$this->images->contains($image)) {
$this->images[] = $image;
$image->setProductPage($this);
}
return $this;
}
public function removeImage(Image $image): self
{
if ($this->images->removeElement($image)) {
// set the owning side to null (unless already changed)
if ($image->getProductPage() === $this) {
$image->setProductPage(null);
}
}
return $this;
}
public function getSubCategory(): ?SubCategory
{
return $this->subCategory;
}
public function setSubCategory(?SubCategory $subCategory): self
{
$this->subCategory = $subCategory;
return $this;
}
}