<?phpnamespace App\Entity;use DateTime;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Vich\UploaderBundle\Mapping\Annotation as Vich;#[Vich\Uploadable]#[ORM\Entity(repositoryClass: "App\Repository\DisasterDeclarationPhotoRepository")]#[ORM\Table(name: "disaster_declaration_photo")]class DisasterDeclarationPhoto { #[ORM\Column(name: "id", type: "integer")] #[ORM\Id] #[ORM\GeneratedValue(strategy: "AUTO")] private ?int $id; #[ORM\Column(type: "boolean")] private bool $isDeleted = false; #[ORM\ManyToOne(targetEntity: DisasterDeclaration::class, inversedBy: "disasterDeclarationPhotos")] #[ORM\JoinColumn(nullable: false)] private DisasterDeclaration $disasterDeclaration; /** * NOTE: This is not a mapped field of entity metadata, just a simple property. */ #[Vich\UploadableField(mapping: "disasterDeclarationPhoto", fileNameProperty: "disasterDeclarationPhotoFileName", size: "disasterDeclarationPhotoFileSize")] private File $disasterDeclarationPhotoFile; #[ORM\Column(type: "string", length: 255, nullable: true)] private ?string $disasterDeclarationPhotoFileName; #[ORM\Column(type: "integer", nullable: true)] private ?int $disasterDeclarationPhotoFileSize; #[ORM\Column(type: "datetime", nullable: true)] private ?DateTime $disasterDeclarationPhotoFileUpdatedAt; public function __toString() { return "#" . $this->id . " - " . $this->disasterDeclarationPhotoFileName; } /** * If manually uploading a file (i.e. not using Symfony Form) ensure an instance * of 'UploadedFile' is injected into this setter to trigger the update. If this * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter * must be able to accept an instance of 'File' as the bundle will inject one here * during Doctrine hydration. * * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image */ public function setDisasterDeclarationPhotoFile(File $image = null) { $this->disasterDeclarationPhotoFile = $image; if (null !== $image) {// It is required that at least one field changes if you are using doctrine// otherwise the event listeners won't be called and the file is lost $this->disasterDeclarationPhotoFileUpdatedAt = new \DateTime(); } } public function getDisasterDeclarationPhotoFile() { return $this->disasterDeclarationPhotoFile; } /** * Get id * * @return int */ public function getId() { return $this->id; } /** * Set disasterDeclarationPhotoFileName * * @param string $disasterDeclarationPhotoFileName * * @return DisasterDeclarationPhoto */ public function setDisasterDeclarationPhotoFileName($disasterDeclarationPhotoFileName) { $this->disasterDeclarationPhotoFileName = $disasterDeclarationPhotoFileName; return $this; } /** * Get disasterDeclarationPhotoFileName * * @return string */ public function getDisasterDeclarationPhotoFileName() { return $this->disasterDeclarationPhotoFileName; } /** * Set disasterDeclarationPhotoFileSize * * @param integer $disasterDeclarationPhotoFileSize * * @return DisasterDeclarationPhoto */ public function setDisasterDeclarationPhotoFileSize($disasterDeclarationPhotoFileSize) { $this->disasterDeclarationPhotoFileSize = $disasterDeclarationPhotoFileSize; return $this; } /** * Get disasterDeclarationPhotoFileSize * * @return integer */ public function getDisasterDeclarationPhotoFileSize() { return $this->disasterDeclarationPhotoFileSize; } /** * Set disasterDeclarationPhotoFileUpdatedAt * * @param DateTime $disasterDeclarationPhotoFileUpdatedAt * * @return DisasterDeclarationPhoto */ public function setDisasterDeclarationPhotoFileUpdatedAt($disasterDeclarationPhotoFileUpdatedAt) { $this->disasterDeclarationPhotoFileUpdatedAt = $disasterDeclarationPhotoFileUpdatedAt; return $this; } /** * Get disasterDeclarationPhotoFileUpdatedAt * * @return DateTime */ public function getDisasterDeclarationPhotoFileUpdatedAt() { return $this->disasterDeclarationPhotoFileUpdatedAt; } /** * Set disasterDeclaration * * @param \App\Entity\DisasterDeclaration $disasterDeclaration * * @return DisasterDeclarationPhoto */ public function setDisasterDeclaration(\App\Entity\DisasterDeclaration $disasterDeclaration) { $this->disasterDeclaration = $disasterDeclaration; return $this; } /** * Get disasterDeclaration * * @return \App\Entity\DisasterDeclaration */ public function getDisasterDeclaration() { return $this->disasterDeclaration; } /** * Set isDeleted * * @param boolean $isDeleted * * @return DisasterDeclarationPhoto */ public function setIsDeleted($isDeleted) { $this->isDeleted = $isDeleted; return $this; } /** * Get isDeleted * * @return boolean */ public function getIsDeleted() { return $this->isDeleted; }}