src/Entity/FileImport.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\HttpFoundation\File\File;
  5. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  6. /**
  7.  * @Vich\Uploadable
  8.  */
  9. #[ORM\Entity(repositoryClass\App\Repository\FileImportRepository::class)]
  10. class FileImport
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column(type'integer')]
  15.     private int $id;
  16.     #[ORM\Column(type'datetime'nullabletrue)]
  17.     private mixed $date;
  18.     #[ORM\Column(type'boolean'nullabletrue)]
  19.     private ?bool $traite;
  20.     #[ORM\Column(type'string'length255nullabletrue)]
  21.     private ?string $filenamenull;
  22.     /**
  23.      * @Vich\UploadableField(mapping="imports", fileNameProperty="filename")
  24.      */
  25.     private ?\Symfony\Component\HttpFoundation\File\File $file null;
  26.     public function setFile(File $file null): void
  27.     {
  28.         $this->file $file;
  29.         if ($file) {
  30.             $date = new \DateTime('now');
  31.             $this->date $date;
  32.         }
  33.     }
  34.     public function getFile(): mixed
  35.     {
  36.         return $this->file;
  37.     }
  38.     public function getId(): int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function getDate(): ?\DateTimeInterface
  43.     {
  44.         return $this->date;
  45.     }
  46.     public function setDate(?\DateTimeInterface $date): self
  47.     {
  48.         $this->date $date;
  49.         return $this;
  50.     }
  51.     public function getTraite(): ?bool
  52.     {
  53.         return $this->traite;
  54.     }
  55.     public function setTraite(?bool $traite): self
  56.     {
  57.         $this->traite $traite;
  58.         return $this;
  59.     }
  60.     public function getFilename(): ?string
  61.     {
  62.         return $this->filename;
  63.     }
  64.     public function setFilename(?string $filename): self
  65.     {
  66.         $this->filename $filename;
  67.         return $this;
  68.     }
  69. }