<?php
// src/Entity/SurveyImage.php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\HttpFoundation\File\File;
/**
* @ORM\Entity()
* @ORM\Table(name="app_survey_image")
* @Vich\Uploadable
*/
class SurveyImage
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private int $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private ?string $imageName = null;
/**
* @Vich\UploadableField(mapping="survey_images", fileNameProperty="imageName")
*/
private ?File $imageFile = null;
/**
* @ORM\ManyToOne(targetEntity=Survey::class, inversedBy="images")
* @ORM\JoinColumn(nullable=true, onDelete="CASCADE")
*/
private ?Survey $survey;
/**
* @ORM\Column(type="boolean")
*/
private bool $isKg = false;
/**
* @ORM\Column(type="datetime")
*/
private \DateTimeInterface $updatedAt;
public function getId(): int
{
return $this->id;
}
public function setImageFile(?File $imageFile = null): void
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageName(?string $imageName): void
{
$this->imageName = $imageName;
}
public function getImageName(): ?string
{
return $this->imageName;
}
public function setSurvey(?Survey $survey): void
{
$this->survey = $survey;
}
public function getSurvey(): Survey
{
return $this->survey;
}
public function isKg(): bool
{
return $this->isKg;
}
public function setIsKg(bool $isKg): self
{
$this->isKg = $isKg;
return $this;
}
}