vendor/sulu/sulu/src/Sulu/Bundle/MediaBundle/Entity/Media.php line 22

Open in your IDE?
  1. <?php
  2. /*
  3. * This file is part of Sulu.
  4. *
  5. * (c) Sulu GmbH
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. namespace Sulu\Bundle\MediaBundle\Entity;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection as DoctrineCollection;
  13. use JMS\Serializer\Annotation\Exclude;
  14. use Sulu\Component\Persistence\Model\AuditableTrait;
  15. /**
  16. * Media.
  17. */
  18. class Media implements MediaInterface
  19. {
  20. use AuditableTrait;
  21. /**
  22. * @var int
  23. */
  24. protected $id;
  25. /**
  26. * @var DoctrineCollection<int, File>
  27. */
  28. protected $files;
  29. /**
  30. * @var CollectionInterface
  31. */
  32. #[Exclude]
  33. protected $collection;
  34. /**
  35. * @var MediaType
  36. */
  37. protected $type;
  38. /**
  39. * @var MediaInterface|null
  40. */
  41. protected $previewImage;
  42. /**
  43. * Constructor.
  44. */
  45. public function __construct()
  46. {
  47. $this->files = new ArrayCollection();
  48. }
  49. public function getId()
  50. {
  51. return $this->id;
  52. }
  53. public function addFile(File $files)
  54. {
  55. $this->files[] = $files;
  56. return $this;
  57. }
  58. public function removeFile(File $files)
  59. {
  60. $this->files->removeElement($files);
  61. }
  62. public function getFiles()
  63. {
  64. return $this->files;
  65. }
  66. public function setCollection(CollectionInterface $collection)
  67. {
  68. $this->collection = $collection;
  69. return $this;
  70. }
  71. public function getCollection()
  72. {
  73. return $this->collection;
  74. }
  75. public function setType(MediaType $type)
  76. {
  77. $this->type = $type;
  78. return $this;
  79. }
  80. public function getType()
  81. {
  82. return $this->type;
  83. }
  84. public function setPreviewImage(?MediaInterface $previewImage = null)
  85. {
  86. $this->previewImage = $previewImage;
  87. return $this;
  88. }
  89. public function getPreviewImage()
  90. {
  91. return $this->previewImage;
  92. }
  93. }