vendor/sulu/sulu/src/Sulu/Bundle/MediaBundle/Entity/MediaType.php line 21

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. /**
  15. * MediaType.
  16. */
  17. class MediaType
  18. {
  19. /**
  20. * @var string
  21. */
  22. private $name;
  23. /**
  24. * @var string|null
  25. */
  26. private $description;
  27. /**
  28. * @var int
  29. */
  30. private $id;
  31. /**
  32. * @var DoctrineCollection<int, MediaInterface>
  33. */
  34. #[Exclude]
  35. private $media;
  36. /**
  37. * Constructor.
  38. */
  39. public function __construct()
  40. {
  41. $this->media = new ArrayCollection();
  42. }
  43. /**
  44. * Set name.
  45. *
  46. * @param string $name
  47. *
  48. * @return MediaType
  49. */
  50. public function setName($name)
  51. {
  52. $this->name = $name;
  53. return $this;
  54. }
  55. /**
  56. * Get name.
  57. *
  58. * @return string
  59. */
  60. public function getName()
  61. {
  62. return $this->name;
  63. }
  64. /**
  65. * Set description.
  66. *
  67. * @param string|null $description
  68. *
  69. * @return MediaType
  70. */
  71. public function setDescription($description)
  72. {
  73. $this->description = $description;
  74. return $this;
  75. }
  76. /**
  77. * Get description.
  78. *
  79. * @return string|null
  80. */
  81. public function getDescription()
  82. {
  83. return $this->description;
  84. }
  85. /**
  86. * To force id = 1 in load fixtures.
  87. *
  88. * @param int $id
  89. *
  90. * @return void
  91. */
  92. public function setId($id)
  93. {
  94. $this->id = $id;
  95. }
  96. /**
  97. * Get id.
  98. *
  99. * @return int
  100. */
  101. public function getId()
  102. {
  103. return $this->id;
  104. }
  105. /**
  106. * Add media.
  107. *
  108. * @return MediaType
  109. */
  110. public function addMedia(MediaInterface $media)
  111. {
  112. $this->media[] = $media;
  113. return $this;
  114. }
  115. /**
  116. * Remove media.
  117. *
  118. * @return void
  119. */
  120. public function removeMedia(MediaInterface $media)
  121. {
  122. $this->media->removeElement($media);
  123. }
  124. /**
  125. * Get media.
  126. *
  127. * @return DoctrineCollection<int, MediaInterface>
  128. */
  129. public function getMedia()
  130. {
  131. return $this->media;
  132. }
  133. }