src/Entity/Slider.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SliderRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. #[ORM\Entity(repositoryClassSliderRepository::class)]
  9. class Slider
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $title null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $image null;
  19.     #[ORM\Column(typeTypes::TEXT)]
  20.     private ?string $description null;
  21.     #[Vich\UploadableField(mapping:'post_thumbnails'fileNameProperty:'image')]
  22.     private $imageFile;
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getTitle(): ?string
  28.     {
  29.         return $this->title;
  30.     }
  31.     public function setTitle(string $title): self
  32.     {
  33.         $this->title $title;
  34.         return $this;
  35.     }
  36.     public function getImage(): ?string
  37.     {
  38.         return $this->image;
  39.     }
  40.     public function setImage(string $image): self
  41.     {
  42.         $this->image $image;
  43.         return $this;
  44.     }
  45.     public function getDescription(): ?string
  46.     {
  47.         return $this->description;
  48.     }
  49.     public function setDescription(string $description): self
  50.     {
  51.         $this->description $description;
  52.         return $this;
  53.     }
  54.     public function setImageFile(File $image null)
  55.     {
  56.         $this->imageFile $image;
  57.         // VERY IMPORTANT:
  58.         // It is required that at least one field changes if you are using Doctrine,
  59.         // otherwise the event listeners won't be called and the file is lost
  60.         //  if ($image) {
  61.         // if 'updatedAt' is not defined in your entity, use another property
  62.         // $this->updatedAt = new \DateTime('now');
  63.         // }
  64.     }
  65.     public function getImageFile()
  66.     {
  67.         return $this->imageFile;
  68.     }
  69. }