src/Entity/MediaObject.php line 16

  1. <?php
  2. // api/src/Entity/MediaObject.php
  3. namespace App\Entity;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Symfony\Component\Serializer\Annotation\MaxDepth;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. use Gedmo\Mapping\Annotation as Gedmo;
  11. #[Vich\Uploadable]
  12. #[ORM\Entity]
  13. class MediaObject
  14. {
  15.     #[ORM\IdORM\ColumnORM\GeneratedValue]
  16.     private ?int $id null;
  17.     #[Vich\UploadableField(mapping"media_object"fileNameProperty"filePath")]
  18.     #[Assert\NotNull(groups: ['media_object_create'])]
  19.     public ?File $file null;
  20.     #[ORM\Column(nullabletrue)]
  21.     private ?string $filePath null;
  22.     #[ORM\Column(length64nullabletrue)]
  23.     private ?string $mimeType null;
  24.     #[ORM\Column(nullabletrue)]
  25.     private ?int $size null;
  26.     #[ORM\Column]
  27.     #[Gedmo\Timestampable(on'create')]
  28.     private ?\DateTimeImmutable $createdAt null;
  29.     #[ORM\ManyToOne]
  30.     #[ORM\JoinColumn(nullablefalse)]
  31.     #[Gedmo\Blameable(on'create')]
  32.     private ?User $createdBy null;
  33.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  34.     private ?\DateTimeInterface $uploadedAt null;
  35.     #[ORM\Column(length255nullabletrue)]
  36.     private ?string $fullPath null;
  37.     #[ORM\Column(nullabletrue)]
  38.     private ?int $foreignKey null;
  39.     #[ORM\Column(length255nullabletrue)]
  40.     private ?string $entity null;
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getMimeType(): ?string
  46.     {
  47.         return $this->mimeType;
  48.     }
  49.     public function setMimeType(?string $mimeType): self
  50.     {
  51.         $this->mimeType $mimeType;
  52.         return $this;
  53.     }
  54.     public function getSize(): ?int
  55.     {
  56.         return $this->size;
  57.     }
  58.     public function setSize(?int $size): self
  59.     {
  60.         $this->size $size;
  61.         return $this;
  62.     }
  63.     public function getCreatedAt(): ?\DateTimeImmutable
  64.     {
  65.         return $this->createdAt;
  66.     }
  67.     public function setCreatedAt(\DateTimeImmutable $createdAt): self
  68.     {
  69.         $this->createdAt $createdAt;
  70.         return $this;
  71.     }
  72.     public function getCreatedBy(): ?User
  73.     {
  74.         return $this->createdBy;
  75.     }
  76.     public function setCreatedBy(?User $createdBy): self
  77.     {
  78.         $this->createdBy $createdBy;
  79.         return $this;
  80.     }
  81.     /**
  82.      * @return string|null
  83.      */
  84.     public function getFilePath(): ?string
  85.     {
  86.         return $this->filePath;
  87.     }
  88.     /**
  89.      * @param string|null $filePath
  90.      */
  91.     public function setFilePath(?string $filePath): void
  92.     {
  93.         $this->filePath $filePath;
  94.     }
  95.     public function getUploadedAt(): ?\DateTimeInterface
  96.     {
  97.         return $this->uploadedAt;
  98.     }
  99.     public function setUploadedAt(?\DateTimeInterface $uploadedAt): self
  100.     {
  101.         $this->uploadedAt $uploadedAt;
  102.         return $this;
  103.     }
  104.     public function getFullPath(): ?string
  105.     {
  106.         return $this->fullPath;
  107.     }
  108.     public function setFullPath(?string $fullPath): static
  109.     {
  110.         $this->fullPath $fullPath;
  111.         return $this;
  112.     }
  113.     public function getFile(): ?File
  114.     {
  115.         return $this->file;
  116.     }
  117.     public function setFile(?File $file): static
  118.     {
  119.         $this->file $file;
  120.         return $this;
  121.     }
  122.     public function getForeignKey(): ?int
  123.     {
  124.         return $this->foreignKey;
  125.     }
  126.     public function setForeignKey(?int $foreignKey): static
  127.     {
  128.         $this->foreignKey $foreignKey;
  129.         return $this;
  130.     }
  131.     public function getEntity(): ?string
  132.     {
  133.         return $this->entity;
  134.     }
  135.     public function setEntity(?string $entity): static
  136.     {
  137.         $this->entity $entity;
  138.         return $this;
  139.     }
  140. }