src/Entity/Gallery/GalleryImage.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gallery;
  3. use App\Entity\AbstractBase;
  4. use App\Entity\Interfaces\ImageNotNullInterface;
  5. use App\Entity\Traits\HasImageNotNullTrait;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11.  * @ORM\Table(name="vulco_gallery_image")
  12.  * @ORM\Entity(repositoryClass=GalleryImageRepository::class)
  13.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  14.  * @Vich\Uploadable
  15.  */
  16. class GalleryImage extends AbstractBase implements ImageNotNullInterface
  17. {
  18.     use HasImageNotNullTrait;
  19.     /**
  20.      * @ORM\Column(type="string", length=255, nullable=true)
  21.      */
  22.     private ?string $name null;
  23.     /**
  24.      * @Vich\UploadableField(mapping="gallery_image_image", fileNameProperty="imageName")
  25.      */
  26.     private ?File $image null;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity="App\Entity\Gallery\GalleryAlbum", inversedBy="images")
  29.      *
  30.      * @ORM\JoinColumn(name="album_id", referencedColumnName="id")
  31.      */
  32.     private GalleryAlbum $album;
  33.     public function __construct()
  34.     {
  35.         $this->setHasImage(false);
  36.     }
  37.     public function getName(): ?string
  38.     {
  39.         return $this->name;
  40.     }
  41.     public function setName(?string $name): self
  42.     {
  43.         $this->name $name;
  44.         return $this;
  45.     }
  46.     public function getAlbum(): GalleryAlbum
  47.     {
  48.         return $this->album;
  49.     }
  50.     public function setAlbum(GalleryAlbum $album): self
  51.     {
  52.         $this->album $album;
  53.         return $this;
  54.     }
  55. }