src/Entity/Gallery/GalleryAlbum.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gallery;
  3. use App\Annotation\SiteAware;
  4. use App\Entity\AbstractBase;
  5. use App\Entity\Interfaces\PublishedInterface;
  6. use App\Entity\Interfaces\SiteInterface;
  7. use App\Entity\Traits\NameTrait;
  8. use App\Entity\Traits\PositionTrait;
  9. use App\Entity\Traits\PublishedTrait;
  10. use App\Entity\Traits\SiteTrait;
  11. use App\Repository\Gallery\GalleryAlbumRepository;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Doctrine\Common\Collections\Collection;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Gedmo\Mapping\Annotation as Gedmo;
  16. use Symfony\Component\HttpFoundation\File\UploadedFile;
  17. /**
  18.  * @ORM\Table(name="vulco_gallery_album", indexes={@ORM\Index(name="gallery_album_site_idx", columns={"site"})})
  19.  * @ORM\Entity(repositoryClass=GalleryAlbumRepository::class)
  20.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  21.  * @SiteAware(siteFieldName="site")
  22.  */
  23. class GalleryAlbum extends AbstractBase implements SiteInterfacePublishedInterface
  24. {
  25.     use NameTrait;
  26.     use SiteTrait;
  27.     use PublishedTrait;
  28.     use PositionTrait;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=false)
  31.      */
  32.     private string $name;
  33.     /**
  34.      * @ORM\Column(type="integer", nullable=false)
  35.      */
  36.     private int $position 0;
  37.     /**
  38.      * @ORM\Column(type="text", length=10000, nullable=true)
  39.      */
  40.     private ?string $zipLink null;
  41.     /**
  42.      * @ORM\OneToMany(targetEntity="App\Entity\Gallery\GalleryImage", mappedBy="album", cascade={"persist", "remove"}, orphanRemoval=true)
  43.      */
  44.     private ?Collection $images;
  45.     /**
  46.      * @ORM\OneToMany(targetEntity="App\Entity\Gallery\GalleryVideo", mappedBy="album", cascade={"persist", "remove"}, orphanRemoval=true)
  47.      */
  48.     private ?Collection $videos;
  49.     /**
  50.      * @var UploadedFile[]
  51.      */
  52.     private ?array $multipleImage null;
  53.     public function __construct()
  54.     {
  55.         $this->images = new ArrayCollection();
  56.         $this->videos = new ArrayCollection();
  57.         $this->published false;
  58.     }
  59.     public function getZipLink(): ?string
  60.     {
  61.         return $this->zipLink;
  62.     }
  63.     public function setZipLink(?string $zipLink): self
  64.     {
  65.         $this->zipLink $zipLink;
  66.         return $this;
  67.     }
  68.     public function getImages(): ?Collection
  69.     {
  70.         return $this->images;
  71.     }
  72.     public function setImages(?Collection $images): self
  73.     {
  74.         $this->images $images;
  75.         return $this;
  76.     }
  77.     public function addImage(GalleryImage $image): self
  78.     {
  79.         if (!$this->images->contains($image)) {
  80.             $this->images->add($image);
  81.             $image->setAlbum($this);
  82.         }
  83.         return $this;
  84.     }
  85.     public function removeImage(GalleryImage $image): self
  86.     {
  87.         if ($this->images->contains($image)) {
  88.             $this->images->removeElement($image);
  89.         }
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return UploadedFile[]|null
  94.      */
  95.     public function getMultipleImage(): ?array
  96.     {
  97.         return $this->multipleImage;
  98.     }
  99.     /**
  100.      * @param UploadedFile[] $multipleImage
  101.      */
  102.     public function setMultipleImage(array $multipleImage): self
  103.     {
  104.         $this->multipleImage $multipleImage;
  105.         return $this;
  106.     }
  107.     public function getVideos(): ?Collection
  108.     {
  109.         return $this->videos;
  110.     }
  111.     public function setVideos(?Collection $videos): self
  112.     {
  113.         $this->videos $videos;
  114.         return $this;
  115.     }
  116.     public function addVideo(GalleryVideo $video): self
  117.     {
  118.         if (!$this->videos->contains($video)) {
  119.             $this->videos->add($video);
  120.             $video->setAlbum($this);
  121.         }
  122.         return $this;
  123.     }
  124.     public function removeVideo(GalleryVideo $video): self
  125.     {
  126.         if ($this->videos->contains($video)) {
  127.             $this->videos->removeElement($video);
  128.         }
  129.         return $this;
  130.     }
  131. }