src/Entity/GalleryPhoto.php line 13

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 Symfony\Component\Serializer\Annotation\Groups;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\GalleryPhotoRepository")
  9.  */
  10. class GalleryPhoto
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      * @Groups("galleryPhoto")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      * @Groups("galleryPhoto")
  22.      */
  23.     private $galleryTitle;
  24.     /**
  25.      * @ORM\Column(type="date")
  26.      * @Groups("galleryPhoto")
  27.      */
  28.     private $dateCreating;
  29.     /**
  30.      * @ORM\Column(type="string", length=255)
  31.      * @Groups("galleryPhoto")
  32.      */
  33.     private $galleryDescription;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity="App\Entity\User", inversedBy="galleryPhotos")
  36.      */
  37.     private $userProperty;
  38.     /**
  39.      * @ORM\ManyToMany(targetEntity="App\Entity\Photo", mappedBy="gallery", cascade={"persist"})
  40.      * @Groups("galleryPhoto")
  41.      */
  42.     private $photos;
  43.     /**
  44.      * @ORM\Column(type="json", nullable=true)
  45.      */
  46.     private $selectHeaderSlide = [];
  47.     public function __construct()
  48.     {
  49.         $this->photos = new ArrayCollection();
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getGalleryTitle(): ?string
  56.     {
  57.         return $this->galleryTitle;
  58.     }
  59.     public function setGalleryTitle(string $galleryTitle): self
  60.     {
  61.         $this->galleryTitle $galleryTitle;
  62.         return $this;
  63.     }
  64.     public function getDateCreating(): ?\DateTimeInterface
  65.     {
  66.         return $this->dateCreating;
  67.     }
  68.     public function setDateCreating(\DateTimeInterface $dateCreating): self
  69.     {
  70.         $this->dateCreating $dateCreating;
  71.         return $this;
  72.     }
  73.     public function getGalleryDescription(): ?string
  74.     {
  75.         return $this->galleryDescription;
  76.     }
  77.     public function setGalleryDescription(string $galleryDescription): self
  78.     {
  79.         $this->galleryDescription $galleryDescription;
  80.         return $this;
  81.     }
  82.     public function getUserProperty(): ?User
  83.     {
  84.         return $this->userProperty;
  85.     }
  86.     public function setUserProperty(?User $userProperty): self
  87.     {
  88.         $this->userProperty $userProperty;
  89.         return $this;
  90.     }
  91.     /**
  92.      * @return Collection|Photo[]
  93.      */
  94.     public function getPhotos(): Collection
  95.     {
  96.         return $this->photos;
  97.     }
  98.     public function addPhoto(Photo $photo): self
  99.     {
  100.         if (!$this->photos->contains($photo)) {
  101.             $this->photos[] = $photo;
  102.             $photo->addGallery($this);
  103.         }
  104.         return $this;
  105.     }
  106.     public function removePhoto(Photo $photo): self
  107.     {
  108.         if ($this->photos->contains($photo)) {
  109.             $this->photos->removeElement($photo);
  110.             $photo->removeGallery($this);
  111.         }
  112.         return $this;
  113.     }
  114.     public function getSelectHeaderSlide(): ?array
  115.     {
  116.         return $this->selectHeaderSlide;
  117.     }
  118.     public function setSelectHeaderSlide(?array $selectHeaderSlide): self
  119.     {
  120.         $this->selectHeaderSlide $selectHeaderSlide;
  121.         return $this;
  122.     }
  123. }