src/Entity/DisasterDeclarationPhoto.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. #[Vich\Uploadable]
  8. #[ORM\Entity(repositoryClass"App\Repository\DisasterDeclarationPhotoRepository")]
  9. #[ORM\Table(name"disaster_declaration_photo")]
  10. class DisasterDeclarationPhoto {
  11.     #[ORM\Column(name"id"type"integer")]
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue(strategy"AUTO")]
  14.     private ?int $id;
  15.     #[ORM\Column(type"boolean")]
  16.     private bool $isDeleted false;
  17.     #[ORM\ManyToOne(targetEntityDisasterDeclaration::class, inversedBy"disasterDeclarationPhotos")]
  18.     #[ORM\JoinColumn(nullablefalse)]
  19.     private DisasterDeclaration $disasterDeclaration;
  20.     /**
  21.      * NOTE: This is not a mapped field of entity metadata, just a simple property.
  22.      */
  23.     #[Vich\UploadableField(mapping"disasterDeclarationPhoto"fileNameProperty"disasterDeclarationPhotoFileName"size"disasterDeclarationPhotoFileSize")]
  24.     private File $disasterDeclarationPhotoFile;
  25.     #[ORM\Column(type"string"length255nullabletrue)]
  26.     private ?string $disasterDeclarationPhotoFileName;
  27.     #[ORM\Column(type"integer"nullabletrue)]
  28.     private ?int $disasterDeclarationPhotoFileSize;
  29.     #[ORM\Column(type"datetime"nullabletrue)]
  30.     private ?DateTime $disasterDeclarationPhotoFileUpdatedAt;
  31.     public function __toString() {
  32.         return "#" $this->id " - " $this->disasterDeclarationPhotoFileName;
  33.     }
  34.     /**
  35.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  36.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  37.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  38.      * must be able to accept an instance of 'File' as the bundle will inject one here
  39.      * during Doctrine hydration.
  40.      *
  41.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
  42.      */
  43.     public function setDisasterDeclarationPhotoFile(File $image null) {
  44.         $this->disasterDeclarationPhotoFile $image;
  45.         if (null !== $image) {
  46. // It is required that at least one field changes if you are using doctrine
  47. // otherwise the event listeners won't be called and the file is lost
  48.             $this->disasterDeclarationPhotoFileUpdatedAt = new \DateTime();
  49.         }
  50.     }
  51.     public function getDisasterDeclarationPhotoFile() {
  52.         return $this->disasterDeclarationPhotoFile;
  53.     }
  54.     /**
  55.      * Get id
  56.      *
  57.      * @return int
  58.      */
  59.     public function getId() {
  60.         return $this->id;
  61.     }
  62.     /**
  63.      * Set disasterDeclarationPhotoFileName
  64.      *
  65.      * @param string $disasterDeclarationPhotoFileName
  66.      *
  67.      * @return DisasterDeclarationPhoto
  68.      */
  69.     public function setDisasterDeclarationPhotoFileName($disasterDeclarationPhotoFileName) {
  70.         $this->disasterDeclarationPhotoFileName $disasterDeclarationPhotoFileName;
  71.         return $this;
  72.     }
  73.     /**
  74.      * Get disasterDeclarationPhotoFileName
  75.      *
  76.      * @return string
  77.      */
  78.     public function getDisasterDeclarationPhotoFileName() {
  79.         return $this->disasterDeclarationPhotoFileName;
  80.     }
  81.     /**
  82.      * Set disasterDeclarationPhotoFileSize
  83.      *
  84.      * @param integer $disasterDeclarationPhotoFileSize
  85.      *
  86.      * @return DisasterDeclarationPhoto
  87.      */
  88.     public function setDisasterDeclarationPhotoFileSize($disasterDeclarationPhotoFileSize) {
  89.         $this->disasterDeclarationPhotoFileSize $disasterDeclarationPhotoFileSize;
  90.         return $this;
  91.     }
  92.     /**
  93.      * Get disasterDeclarationPhotoFileSize
  94.      *
  95.      * @return integer
  96.      */
  97.     public function getDisasterDeclarationPhotoFileSize() {
  98.         return $this->disasterDeclarationPhotoFileSize;
  99.     }
  100.     /**
  101.      * Set disasterDeclarationPhotoFileUpdatedAt
  102.      *
  103.      * @param DateTime $disasterDeclarationPhotoFileUpdatedAt
  104.      *
  105.      * @return DisasterDeclarationPhoto
  106.      */
  107.     public function setDisasterDeclarationPhotoFileUpdatedAt($disasterDeclarationPhotoFileUpdatedAt) {
  108.         $this->disasterDeclarationPhotoFileUpdatedAt $disasterDeclarationPhotoFileUpdatedAt;
  109.         return $this;
  110.     }
  111.     /**
  112.      * Get disasterDeclarationPhotoFileUpdatedAt
  113.      *
  114.      * @return DateTime
  115.      */
  116.     public function getDisasterDeclarationPhotoFileUpdatedAt() {
  117.         return $this->disasterDeclarationPhotoFileUpdatedAt;
  118.     }
  119.     /**
  120.      * Set disasterDeclaration
  121.      *
  122.      * @param \App\Entity\DisasterDeclaration $disasterDeclaration
  123.      *
  124.      * @return DisasterDeclarationPhoto
  125.      */
  126.     public function setDisasterDeclaration(\App\Entity\DisasterDeclaration $disasterDeclaration) {
  127.         $this->disasterDeclaration $disasterDeclaration;
  128.         return $this;
  129.     }
  130.     /**
  131.      * Get disasterDeclaration
  132.      *
  133.      * @return \App\Entity\DisasterDeclaration
  134.      */
  135.     public function getDisasterDeclaration() {
  136.         return $this->disasterDeclaration;
  137.     }
  138.     /**
  139.      * Set isDeleted
  140.      *
  141.      * @param boolean $isDeleted
  142.      *
  143.      * @return DisasterDeclarationPhoto
  144.      */
  145.     public function setIsDeleted($isDeleted)
  146.     {
  147.         $this->isDeleted $isDeleted;
  148.         return $this;
  149.     }
  150.     /**
  151.      * Get isDeleted
  152.      *
  153.      * @return boolean
  154.      */
  155.     public function getIsDeleted()
  156.     {
  157.         return $this->isDeleted;
  158.     }
  159. }