src/Entity/PageSliderSlide.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\CommonTrait;
  4. use App\Repository\PageSliderSlideRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Entity\File as EmbeddedFile;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. use Symfony\Component\HttpFoundation\File\UploadedFile;
  11. /**
  12.  * @ORM\Entity(repositoryClass=PageSliderSlideRepository::class)
  13.  * @ORM\Table(name="app_page_slider_slide")
  14.  * @ORM\HasLifecycleCallbacks()
  15.  * @UniqueEntity({"uuid"})
  16.  */
  17. #[Vich\Uploadable]
  18. class PageSliderSlide
  19. {
  20.     use CommonTrait;
  21.     /**
  22.      * @ORM\Column(type="string", length=255, nullable=true)
  23.      */
  24.     private $title;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      */
  28.     private $description;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=PageSlider::class, inversedBy="slides")
  31.      */
  32.     private $slider;
  33.     /**
  34.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  35.      *
  36.      *
  37.      * @var File|null
  38.      */
  39.     #[Vich\UploadableField(mapping'slide'fileNameProperty'imageFile.name'size'imageFile.size'mimeType'imageFile.mimeType'originalName'imageFile.originalName'dimensions'imageFile.dimensions')]
  40.     private $image;
  41.     /**
  42.      * @ORM\Embedded(class="Vich\UploaderBundle\Entity\File")
  43.      *
  44.      * @var EmbeddedFile
  45.      */
  46.     private $imageFile;
  47.     /**
  48.      * @ORM\Column(type="integer", nullable=true)
  49.      */
  50.     private $textPosition;
  51.     /**
  52.      * @ORM\Column(type="string", length=255, nullable=true)
  53.      */
  54.     private $hrefTo;
  55.     public function __construct()
  56.     {
  57.         $this->imageFile = new EmbeddedFile();
  58.     }
  59.     public function getTitle(): ?string
  60.     {
  61.         return $this->title;
  62.     }
  63.     public function setTitle(?string $title): self
  64.     {
  65.         $this->title $title;
  66.         return $this;
  67.     }
  68.     public function getDescription(): ?string
  69.     {
  70.         return $this->description;
  71.     }
  72.     public function setDescription(?string $description): self
  73.     {
  74.         $this->description $description;
  75.         return $this;
  76.     }
  77.     public function getSlider(): ?PageSlider
  78.     {
  79.         return $this->slider;
  80.     }
  81.     public function setSlider(?PageSlider $slider): self
  82.     {
  83.         $this->slider $slider;
  84.         return $this;
  85.     }
  86.     public function setImage(?File $image null)
  87.     {
  88.         $this->image $image;
  89.         if (null !== $image) {
  90.             // It is required that at least one field changes if you are using doctrine
  91.             // otherwise the event listeners won't be called and the file is lost
  92.             $this->updatedAt = new \DateTimeImmutable();
  93.         }
  94.     }
  95.     public function getImage(): ?File
  96.     {
  97.         return $this->image;
  98.     }
  99.     public function setImageFile(EmbeddedFile $image): void
  100.     {
  101.         $this->imageFile $image;
  102.     }
  103.     public function getImageFile(): ?EmbeddedFile
  104.     {
  105.         return $this->imageFile;
  106.     }
  107.     public function getTextPosition(): ?int
  108.     {
  109.         return $this->textPosition;
  110.     }
  111.     public function setTextPosition(?int $textPosition): self
  112.     {
  113.         $this->textPosition $textPosition;
  114.         return $this;
  115.     }
  116.     public function getHrefTo(): ?string
  117.     {
  118.         return $this->hrefTo;
  119.     }
  120.     public function setHrefTo(?string $link): self
  121.     {
  122.         $this->hrefTo $link;
  123.         return $this;
  124.     }
  125. }