src/Entity/Gos/AdditionalFile.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gos;
  3. use App\Repository\Gos\AdditionalFileRepository;
  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=AdditionalFileRepository::class)
  9.  * @ORM\HasLifecycleCallbacks()
  10.  * @Vich\Uploadable()
  11.  */
  12. class AdditionalFile
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $label;
  24.     /**
  25.      * @ORM\Column(type="datetime")
  26.      */
  27.     private $createdAt;
  28.     /**
  29.      * @ORM\Column(type="datetime", nullable=true)
  30.      */
  31.     private $updatedAt;
  32.     /**
  33.      * @ORM\ManyToOne(targetEntity=ProductVariant::class, inversedBy="additionalFiles")
  34.      */
  35.     private $productVariant;
  36.     /**
  37.      * @Vich\UploadableField(mapping="additional_file", fileNameProperty="fileName")
  38.      * @Assert\File(maxSize="800M")
  39.      */
  40.     private $file;
  41.     /**
  42.      * @ORM\Column(type="string", length=255, nullable=true)
  43.      */
  44.     private $fileName;
  45.     /** @ORM\PrePersist() */
  46.     public function onPrePersist(): void
  47.     {
  48.         $this->createdAt = new \DateTime();
  49.     }
  50.     /** @ORM\PreUpdate() */
  51.     public function onPreUpdate(): void
  52.     {
  53.         $this->updatedAt = new \DateTime();
  54.     }
  55.     public function getId(): ?int
  56.     {
  57.         return $this->id;
  58.     }
  59.     public function getLabel(): ?string
  60.     {
  61.         return $this->label;
  62.     }
  63.     public function setLabel(string $label): self
  64.     {
  65.         $this->label $label;
  66.         return $this;
  67.     }
  68.     public function getCreatedAt(): ?\DateTimeInterface
  69.     {
  70.         return $this->createdAt;
  71.     }
  72.     public function setCreatedAt(\DateTimeInterface $createdAt): self
  73.     {
  74.         $this->createdAt $createdAt;
  75.         return $this;
  76.     }
  77.     public function getUpdatedAt(): ?\DateTimeInterface
  78.     {
  79.         return $this->updatedAt;
  80.     }
  81.     public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  82.     {
  83.         $this->updatedAt $updatedAt;
  84.         return $this;
  85.     }
  86.     public function getProductVariant(): ?ProductVariant
  87.     {
  88.         return $this->productVariant;
  89.     }
  90.     public function setProductVariant(?ProductVariant $productVariant): self
  91.     {
  92.         $this->productVariant $productVariant;
  93.         return $this;
  94.     }
  95.     public function getFile(): ?\Symfony\Component\HttpFoundation\File\File
  96.     {
  97.         return $this->file;
  98.     }
  99.     public function setFile(?\Symfony\Component\HttpFoundation\File\File $file null): void
  100.     {
  101.         $this->file $file;
  102.         if (null !== $file) {
  103.             $this->updatedAt = new \DateTimeImmutable();
  104.         }
  105.     }
  106.     public function getFileName(): ?string
  107.     {
  108.         return $this->fileName;
  109.     }
  110.     public function setFileName(?string $fileName): self
  111.     {
  112.         $this->fileName $fileName;
  113.         return $this;
  114.     }
  115. }