<?php
namespace App\Entity\Gos;
use App\Repository\Gos\EventFilesRepository;
use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=EventFilesRepository::class)
* @ORM\HasLifecycleCallbacks()
* @Vich\Uploadable()
*/
class EventFiles
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @Vich\UploadableField(mapping="event_extra_files", fileNameProperty="fileName", size="fileSize", mimeType="mimeType")
* @Assert\File(maxSize="200M")
*/
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="integer", nullable=true)
*/
private $deactivateAfterDays;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $accessTo;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $updatedAt;
/**
* @ORM\ManyToOne(targetEntity=Events::class, inversedBy="eventFiles")
*/
private $event;
/**
* @ORM\ManyToOne(targetEntity=EventFileType::class, inversedBy="eventFile")
*/
private $eventFileType;
/**
* @ORM\Column(type="string", length=255)
*/
private $label;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $url;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $hash;
/** @ORM\PrePersist() */
public function onPrePersist(): void
{
$this->createdAt = new \DateTime();
}
/** @ORM\PreUpdate() */
public function onPreUpdate(): void
{
$this->updatedAt = new \DateTime();
}
/** @ORM\PostPersist() */
public function onPostPersist(): void
{
$this->hash = md5('eventFile-'.$this->id);
}
public function getId(): ?int
{
return $this->id;
}
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;
}
/**
* @deprecated BUG-529 - use AccessTo instead
*/
public function getDeactivateAfterDays(): ?int
{
return $this->deactivateAfterDays;
}
public function setDeactivateAfterDays(?int $deactivateAfterDays): self
{
$this->deactivateAfterDays = $deactivateAfterDays;
return $this;
}
public function getAccessTo(): ?\DateTimeInterface
{
return $this->accessTo;
}
public function setAccessTo(\DateTimeInterface $accessTo): self
{
$this->accessTo = $accessTo;
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 getEvent(): ?Events
{
return $this->event;
}
public function setEvent(?Events $event): self
{
$this->event = $event;
return $this;
}
public function getEventFileType(): ?EventFileType
{
return $this->eventFileType;
}
public function setEventFileType(?EventFileType $eventFileType): self
{
$this->eventFileType = $eventFileType;
return $this;
}
public function getLabel(): ?string
{
return $this->label;
}
public function setLabel(?string $label): self
{
$this->label = $label;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getHash(): ?string
{
return $this->hash;
}
public function setHash(?string $hash): self
{
$this->hash = $hash;
return $this;
}
}