<?php
namespace App\Entity;
use App\Repository\FileRepository;
use App\Services\File\FileService;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: FileRepository::class)]
class File
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private ?int $id;
#[ORM\Column(type: 'string', length: 30)]
private ?string $service;
#[ORM\Column(type: 'string', length: 20)]
private ?string $fileType;
#[ORM\Column(type: 'string', length: 100)]
private ?string $mimeType;
#[ORM\Column(type: 'string', length: 1000)]
private ?string $name;
#[ORM\Column(type: 'string', length: 1000)]
private ?string $fileName;
#[ORM\Column(type: 'datetime', nullable: false)]
private ?\DateTimeInterface $timeUploaded;
public function getId(): ?int
{
return $this->id;
}
public function getService(): ?string
{
return $this->service;
}
public function setService(string $service): self
{
$this->service = $service;
return $this;
}
public function getFullPath() {
return "/" . FileService::CONTENT_DIR .
"/" . $this->service .
"/" . $this->fileType .
"/" . $this->timeUploaded->format(FileService::TIME_INTERVAL_FORMAT) .
"/" . $this->fileName
;
}
public function getFileType(): ?string
{
return $this->fileType;
}
public function setFileType(string $fileType): self
{
$this->fileType = $fileType;
return $this;
}
public function getMimeType(): ?string
{
return $this->mimeType;
}
public function setMimeType(string $mimeType): self
{
$this->mimeType = $mimeType;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getFileName(): ?string
{
return $this->fileName;
}
public function setFileName(string $fileName): self
{
$this->fileName = $fileName;
return $this;
}
public function getTimeUploaded(): ?\DateTimeInterface
{
return $this->timeUploaded;
}
public function setTimeUploaded(\DateTimeInterface $timeUploaded): self
{
$this->timeUploaded = $timeUploaded;
return $this;
}
}