src/Entity/QuestionImage.php line 13

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