<?php
namespace App\Entity;
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\FileImportRepository::class)]
class FileImport
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'datetime', nullable: true)]
private mixed $date;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $traite;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $filename= null;
/**
* @Vich\UploadableField(mapping="imports", fileNameProperty="filename")
*/
private ?\Symfony\Component\HttpFoundation\File\File $file = null;
public function setFile(File $file = null): void
{
$this->file = $file;
if ($file) {
$date = new \DateTime('now');
$this->date = $date;
}
}
public function getFile(): mixed
{
return $this->file;
}
public function getId(): int
{
return $this->id;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(?\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getTraite(): ?bool
{
return $this->traite;
}
public function setTraite(?bool $traite): self
{
$this->traite = $traite;
return $this;
}
public function getFilename(): ?string
{
return $this->filename;
}
public function setFilename(?string $filename): self
{
$this->filename = $filename;
return $this;
}
}