<?php
namespace App\Entity\Gos;
use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass="App\Repository\Gos\FileVersionRepository")
* @ORM\HasLifecycleCallbacks()
* @Vich\Uploadable()
*/
class FileVersion
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $label;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Gos\File", inversedBy="versions")
* @ORM\JoinColumn()
*/
private $fileEntity;
/**
* @Vich\UploadableField(mapping="product_files", fileNameProperty="fileName", size="fileSize", mimeType="mimeType")
* @Assert\File(maxSize="800M")
*/
private $file;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $fileName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $mimeType;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $fileSize;
/**
* @ORM\Column(type="boolean")
*/
private $isBaseFile = true;
/**
* @ORM\Column(type="boolean")
*/
private $isShowable = true;
/** @ORM\PrePersist() */
public function onPrePersist(): void
{
$this->createdAt = new \DateTime();
}
/** @ORM\PreUpdate() */
public function onPreUpdate(): void
{
$this->updatedAt = new \DateTime();
}
public function getId(): ?int
{
return $this->id;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(string $label): self
{
$this->label = $label;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getFileEntity(): ?File
{
return $this->fileEntity;
}
public function setFileEntity(?File $fileEntity): self
{
$this->fileEntity = $fileEntity;
return $this;
}
public function getFile(): ?\Symfony\Component\HttpFoundation\File\File
{
return $this->file;
}
public function setFile(?\Symfony\Component\HttpFoundation\File\File $file = null): void
{
$this->file = $file;
if (null !== $file) {
$this->updatedAt = new \DateTimeImmutable();
}
}
public function getFileName(): ?string
{
return $this->fileName;
}
public function setFileName(?string $fileName): self
{
$this->fileName = $fileName;
return $this;
}
public function getMimeType(): ?string
{
return $this->mimeType;
}
public function setMimeType(?string $mimeType): self
{
$this->mimeType = $mimeType;
return $this;
}
public function getFileSize(): ?int
{
return $this->fileSize;
}
public function setFileSize(?int $fileSize): self
{
$this->fileSize = $fileSize;
return $this;
}
public function getIsBaseFile(): ?bool
{
return $this->isBaseFile;
}
public function setIsBaseFile(bool $isBaseFile): self
{
$this->isBaseFile = $isBaseFile;
return $this;
}
public function getIsShowable(): ?bool
{
return $this->isShowable;
}
public function setIsShowable(bool $isShowable): self
{
$this->isShowable = $isShowable;
return $this;
}
}