src/Entity/SurveyImage.php line 14

Open in your IDE?
  1. <?php
  2. // src/Entity/SurveyImage.php
  3. namespace App\Entity;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. /**
  8.  * @ORM\Entity()
  9.  * @ORM\Table(name="app_survey_image")
  10.  * @Vich\Uploadable
  11.  */
  12. class SurveyImage
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private int $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255, nullable=true)
  22.      */
  23.     private ?string $imageName null;
  24.     /**
  25.      * @Vich\UploadableField(mapping="survey_images", fileNameProperty="imageName")
  26.      */
  27.     private ?File $imageFile null;
  28.     /**
  29.      * @ORM\ManyToOne(targetEntity=Survey::class, inversedBy="images")
  30.      * @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
  31.      */
  32.     private ?Survey $survey;
  33.     /**
  34.      * @ORM\Column(type="boolean")
  35.      */
  36.     private bool $isKg false;
  37.     /**
  38.      * @ORM\Column(type="datetime")
  39.      */
  40.     private \DateTimeInterface $updatedAt;
  41.     public function getId(): int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function setImageFile(?File $imageFile null): void
  46.     {
  47.         $this->imageFile $imageFile;
  48.         if (null !== $imageFile) {
  49.             $this->updatedAt = new \DateTimeImmutable();
  50.         }
  51.     }
  52.     public function getImageFile(): ?File
  53.     {
  54.         return $this->imageFile;
  55.     }
  56.     public function setImageName(?string $imageName): void
  57.     {
  58.         $this->imageName $imageName;
  59.     }
  60.     public function getImageName(): ?string
  61.     {
  62.         return $this->imageName;
  63.     }
  64.     public function setSurvey(?Survey $survey): void
  65.     {
  66.         $this->survey $survey;
  67.     }
  68.     public function getSurvey(): Survey
  69.     {
  70.         return $this->survey;
  71.     }
  72.     public function isKg(): bool
  73.     {
  74.         return $this->isKg;
  75.     }
  76.     public function setIsKg(bool $isKg): self
  77.     {
  78.         $this->isKg $isKg;
  79.         return $this;
  80.     }
  81. }