src/Entity/MediaObject.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\SuperClass\BaseEntity;
  4. use App\Repository\MediaObjectRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. /**
  10. * @ORM\Entity(repositoryClass=MediaObjectRepository::class)
  11. * @Vich\Uploadable
  12. */
  13. class MediaObject extends BaseEntity
  14. {
  15. /**
  16. * @Vich\UploadableField(mapping="media_object", fileNameProperty="filepath" , size="imageSize")
  17. */
  18. private $file;
  19. /**
  20. * @ORM\Column(type="string", length=255)
  21. */
  22. private $filepath;
  23. /**
  24. * @var string
  25. */
  26. public ?string $contentUrl;
  27. /**
  28. * @ORM\Column(type="integer")
  29. */
  30. private ?int $imageSize;
  31. /**
  32. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="mediaObjects")
  33. */
  34. private $created_by;
  35. public function getId(): ?int
  36. {
  37. return $this->id;
  38. }
  39. public function getFile(): ?File
  40. {
  41. return $this->file;
  42. }
  43. public function setFile(File $file): self
  44. {
  45. $this->file = $file;
  46. return $this;
  47. }
  48. public function getFilepath(): ?string
  49. {
  50. return $this->filepath;
  51. }
  52. public function setFilepath(string $filepath): self
  53. {
  54. $this->filepath = $filepath;
  55. return $this;
  56. }
  57. public function getCreatedBy(): ?User
  58. {
  59. return $this->created_by;
  60. }
  61. public function setCreatedBy(?User $created_by): self
  62. {
  63. $this->created_by = $created_by;
  64. return $this;
  65. }
  66. public function setImageSize(int $imageSize): self
  67. {
  68. $this->imageSize = $imageSize;
  69. return $this;
  70. }
  71. public function getImageSize(): ?int
  72. {
  73. return $this->imageSize;
  74. }
  75. public function setContentUrl(?string $contentUrl): self
  76. {
  77. $this->contentUrl = $contentUrl;
  78. return $this;
  79. }
  80. public function getContentUrl(): ?string
  81. {
  82. return $this->contentUrl;
  83. }
  84. }