src/Entity/Gos/EventFiles.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Repository\Gos\EventFilesRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass=EventFilesRepository::class)
  9.  * @ORM\HasLifecycleCallbacks()
  10.  * @Vich\Uploadable()
  11.  */
  12. class EventFiles
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @Vich\UploadableField(mapping="event_extra_files", fileNameProperty="fileName", size="fileSize", mimeType="mimeType")
  22.      * @Assert\File(maxSize="200M")
  23.      */
  24.     private $file;
  25.     /**
  26.      * @ORM\Column(type="string", length=255, nullable=true)
  27.      */
  28.     private $fileName;
  29.     /**
  30.      * @ORM\Column(type="string", length=255, nullable=true)
  31.      */
  32.     private $mimeType;
  33.     /**
  34.      * @ORM\Column(type="integer", nullable=true)
  35.      */
  36.     private $fileSize;
  37.     /**
  38.      * @ORM\Column(type="integer", nullable=true)
  39.      */
  40.     private $deactivateAfterDays;
  41.     /**
  42.      * @ORM\Column(type="datetime", nullable=true)
  43.      */
  44.     private $accessTo;
  45.     /**
  46.      * @ORM\Column(type="datetime")
  47.      */
  48.     private $createdAt;
  49.     /**
  50.      * @ORM\Column(type="datetime", nullable=true)
  51.      */
  52.     private $updatedAt;
  53.     /**
  54.      * @ORM\ManyToOne(targetEntity=Events::class, inversedBy="eventFiles")
  55.      */
  56.     private $event;
  57.     /**
  58.      * @ORM\ManyToOne(targetEntity=EventFileType::class, inversedBy="eventFile")
  59.      */
  60.     private $eventFileType;
  61.     /**
  62.      * @ORM\Column(type="string", length=255)
  63.      */
  64.     private $label;
  65.     /**
  66.      * @ORM\Column(type="string", length=255, nullable=true)
  67.      */
  68.     private $url;
  69.     /**
  70.      * @ORM\Column(type="string", length=32, nullable=true)
  71.      */
  72.     private $hash;
  73.     /** @ORM\PrePersist() */
  74.     public function onPrePersist(): void
  75.     {
  76.         $this->createdAt = new \DateTime();
  77.     }
  78.     /** @ORM\PreUpdate() */
  79.     public function onPreUpdate(): void
  80.     {
  81.         $this->updatedAt = new \DateTime();
  82.     }
  83.     /** @ORM\PostPersist() */
  84.     public function onPostPersist(): void
  85.     {
  86.         $this->hash md5('eventFile-'.$this->id);
  87.     }
  88.     public function getId(): ?int
  89.     {
  90.         return $this->id;
  91.     }
  92.     public function getFile(): ?\Symfony\Component\HttpFoundation\File\File
  93.     {
  94.         return $this->file;
  95.     }
  96.     public function setFile(?\Symfony\Component\HttpFoundation\File\File $file null): void
  97.     {
  98.         $this->file $file;
  99.         if (null !== $file) {
  100.             $this->updatedAt = new \DateTimeImmutable();
  101.         }
  102.     }
  103.     public function getFileName(): ?string
  104.     {
  105.         return $this->fileName;
  106.     }
  107.     public function setFileName(?string $fileName): self
  108.     {
  109.         $this->fileName $fileName;
  110.         return $this;
  111.     }
  112.     public function getMimeType(): ?string
  113.     {
  114.         return $this->mimeType;
  115.     }
  116.     public function setMimeType(?string $mimeType): self
  117.     {
  118.         $this->mimeType $mimeType;
  119.         return $this;
  120.     }
  121.     public function getFileSize(): ?int
  122.     {
  123.         return $this->fileSize;
  124.     }
  125.     public function setFileSize(?int $fileSize): self
  126.     {
  127.         $this->fileSize $fileSize;
  128.         return $this;
  129.     }
  130.     /**
  131.      * @deprecated BUG-529 - use AccessTo instead
  132.      */
  133.     public function getDeactivateAfterDays(): ?int
  134.     {
  135.         return $this->deactivateAfterDays;
  136.     }
  137.     public function setDeactivateAfterDays(?int $deactivateAfterDays): self
  138.     {
  139.         $this->deactivateAfterDays $deactivateAfterDays;
  140.         return $this;
  141.     }
  142.     public function getAccessTo(): ?\DateTimeInterface
  143.     {
  144.         return $this->accessTo;
  145.     }
  146.     public function setAccessTo(\DateTimeInterface $accessTo): self
  147.     {
  148.         $this->accessTo $accessTo;
  149.         return $this;
  150.     }
  151.     public function getCreatedAt(): ?\DateTimeInterface
  152.     {
  153.         return $this->createdAt;
  154.     }
  155.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  156.     {
  157.         $this->createdAt $createdAt;
  158.         return $this;
  159.     }
  160.     public function getUpdatedAt(): ?\DateTimeInterface
  161.     {
  162.         return $this->updatedAt;
  163.     }
  164.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  165.     {
  166.         $this->updatedAt $updatedAt;
  167.         return $this;
  168.     }
  169.     public function getEvent(): ?Events
  170.     {
  171.         return $this->event;
  172.     }
  173.     public function setEvent(?Events $event): self
  174.     {
  175.         $this->event $event;
  176.         return $this;
  177.     }
  178.     public function getEventFileType(): ?EventFileType
  179.     {
  180.         return $this->eventFileType;
  181.     }
  182.     public function setEventFileType(?EventFileType $eventFileType): self
  183.     {
  184.         $this->eventFileType $eventFileType;
  185.         return $this;
  186.     }
  187.     public function getLabel(): ?string
  188.     {
  189.         return $this->label;
  190.     }
  191.     public function setLabel(?string $label): self
  192.     {
  193.         $this->label $label;
  194.         return $this;
  195.     }
  196.     public function getUrl(): ?string
  197.     {
  198.         return $this->url;
  199.     }
  200.     public function setUrl(?string $url): self
  201.     {
  202.         $this->url $url;
  203.         return $this;
  204.     }
  205.     public function getHash(): ?string
  206.     {
  207.         return $this->hash;
  208.     }
  209.     public function setHash(?string $hash): self
  210.     {
  211.         $this->hash $hash;
  212.         return $this;
  213.     }
  214. }