src/Entity/ProductPage.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProductPageRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ProductPageRepository::class)
  9.  */
  10. class ProductPage
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255, nullable=true)
  20.      */
  21.     private $name;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $slug;
  26.     /**
  27.      * @ORM\Column(type="text", nullable=true)
  28.      */
  29.     private $description;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $document;
  34.     /**
  35.      * @ORM\Column(type="text", nullable=true)
  36.      */
  37.     private $benefit;
  38.     /**
  39.      * @ORM\OneToMany(targetEntity=Image::class, mappedBy="productPage", cascade={"persist", "remove"})
  40.      */
  41.     private $images;
  42.     /**
  43.      * @ORM\ManyToOne(targetEntity=SubCategory::class, inversedBy="productPages")
  44.      */
  45.     private $subCategory;
  46.     public function __construct()
  47.     {
  48.         $this->images = new ArrayCollection();
  49.     }
  50.     public function getId(): ?int
  51.     {
  52.         return $this->id;
  53.     }
  54.     public function getName(): ?string
  55.     {
  56.         return $this->name;
  57.     }
  58.     public function setName(?string $name): self
  59.     {
  60.         $this->name $name;
  61.         return $this;
  62.     }
  63.     public function getSlug(): ?string
  64.     {
  65.         return $this->slug;
  66.     }
  67.     public function setSlug(?string $slug): self
  68.     {
  69.         $this->slug $slug;
  70.         return $this;
  71.     }
  72.     public function getDescription(): ?string
  73.     {
  74.         return $this->description;
  75.     }
  76.     public function setDescription(?string $description): self
  77.     {
  78.         $this->description $description;
  79.         return $this;
  80.     }
  81.     public function getDocument()
  82.     {
  83.         return $this->document;
  84.     }
  85.     public function setDocument($document)
  86.     {
  87.         $this->document $document;
  88.         return $this;
  89.     }
  90.     public function getBenefit(): ?string
  91.     {
  92.         return $this->benefit;
  93.     }
  94.     public function setBenefit(?string $benefit): self
  95.     {
  96.         $this->benefit $benefit;
  97.         return $this;
  98.     }
  99.     /**
  100.      * @return Collection<int, Image>
  101.      */
  102.     public function getImages(): Collection
  103.     {
  104.         return $this->images;
  105.     }
  106.     public function addImage(Image $image): self
  107.     {
  108.         if (!$this->images->contains($image)) {
  109.             $this->images[] = $image;
  110.             $image->setProductPage($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function removeImage(Image $image): self
  115.     {
  116.         if ($this->images->removeElement($image)) {
  117.             // set the owning side to null (unless already changed)
  118.             if ($image->getProductPage() === $this) {
  119.                 $image->setProductPage(null);
  120.             }
  121.         }
  122.         return $this;
  123.     }
  124.     public function getSubCategory(): ?SubCategory
  125.     {
  126.         return $this->subCategory;
  127.     }
  128.     public function setSubCategory(?SubCategory $subCategory): self
  129.     {
  130.         $this->subCategory $subCategory;
  131.         return $this;
  132.     }
  133. }