src/Entity/ContentImageset.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Doctrine\ORM\Mapping\OneToOne;
  7. use JMS\Serializer\Annotation\Groups;
  8. /**
  9.  * @ORM\Table(name="ContentImageset", indexes={@ORM\Index(name="slug_idx", columns={"slug"}), @ORM\Index(name="title_idx", columns={"title"})})
  10.  *
  11.  * @ORM\Entity(repositoryClass="App\Repository\ContentImagesetRepository")
  12.  */
  13. class ContentImageset extends ContentTypeAbstract
  14. {
  15.     /**
  16.      * @ORM\Id()
  17.      *
  18.      * @ORM\GeneratedValue()
  19.      *
  20.      * @ORM\Column(type="integer")
  21.      *
  22.      * @Groups({"waitrating", "contentlist", "imageset_search"})
  23.      */
  24.     private $id;
  25.     /**
  26.      * @Groups({"contentlist", "imageset_search"})
  27.      *
  28.      * @ORM\Column(type="integer")
  29.      */
  30.     private $pics 0;
  31.     /**
  32.      * @Groups({"contentlist", "contentdetail", "imageset_search"})
  33.      *
  34.      * @OneToOne(targetEntity="Content", mappedBy="imageset", cascade={"persist"})
  35.      */
  36.     private $content;
  37.     /**
  38.      * @ORM\OneToMany(targetEntity="App\Entity\ContentImagesetImage", mappedBy="content_imageset", orphanRemoval=true, cascade={"persist"})
  39.      *
  40.      * @var ArrayCollection
  41.      *
  42.      * @Groups({"imagesetimages"})
  43.      */
  44.     private $images;
  45.     public function __construct()
  46.     {
  47.         parent::__construct();
  48.         $this->images = new ArrayCollection();
  49.     }
  50.     /**
  51.      * @return Collection|ContentImagesetImage[]
  52.      */
  53.     public function getImages(): Collection
  54.     {
  55.         return $this->images;
  56.     }
  57.     public function addImagesetImage(ContentImagesetImage $image): self
  58.     {
  59.         if (!$this->images->contains($image)) {
  60.             $this->images[] = $image;
  61.             $image->setContentImageset($this);
  62.         }
  63.         return $this;
  64.     }
  65.     public function removeImagesetImage(ContentImagesetImage $image): self
  66.     {
  67.         if ($this->images->contains($image)) {
  68.             $this->images->removeElement($image);
  69.             // set the owning side to null (unless already changed)
  70.             if ($image->getContentImageset() === $this) {
  71.                 $image->setContentImageset(null);
  72.             }
  73.         }
  74.         return $this;
  75.     }
  76.     public function setContent(?Content $content): self
  77.     {
  78.         $this->content $content;
  79.         return $this;
  80.     }
  81.     public function getContent(): ?Content
  82.     {
  83.         return $this->content;
  84.     }
  85.     public function getId()
  86.     {
  87.         return $this->id;
  88.     }
  89.     public function getPics(): int
  90.     {
  91.         return $this->pics;
  92.     }
  93.     public function setPics(int $pics): self
  94.     {
  95.         if ($pics 0) {
  96.             $pics 0;
  97.         }
  98.         $this->pics $pics;
  99.         return $this;
  100.     }
  101. }