vendor/sulu/sulu/src/Sulu/Bundle/MediaBundle/Entity/CollectionType.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. * CollectionType.
  16. */
  17. class CollectionType
  18. {
  19. /**
  20. * @var int
  21. */
  22. private $id;
  23. /**
  24. * @var string
  25. */
  26. private $name;
  27. /**
  28. * @var string|null
  29. */
  30. private $key;
  31. /**
  32. * @var string|null
  33. */
  34. private $description;
  35. /**
  36. * @var DoctrineCollection<int, CollectionInterface>
  37. */
  38. #[Exclude]
  39. private $collections;
  40. /**
  41. * Constructor.
  42. */
  43. public function __construct()
  44. {
  45. $this->collections = new ArrayCollection();
  46. }
  47. /**
  48. * Set name.
  49. *
  50. * @param string $name
  51. *
  52. * @return $this
  53. */
  54. public function setName($name)
  55. {
  56. $this->name = $name;
  57. return $this;
  58. }
  59. /**
  60. * Get name.
  61. *
  62. * @return string
  63. */
  64. public function getName()
  65. {
  66. return $this->name;
  67. }
  68. /**
  69. * Set description.
  70. *
  71. * @param string|null $description
  72. *
  73. * @return $this
  74. */
  75. public function setDescription($description)
  76. {
  77. $this->description = $description;
  78. return $this;
  79. }
  80. /**
  81. * Get description.
  82. *
  83. * @return string|null
  84. */
  85. public function getDescription()
  86. {
  87. return $this->description;
  88. }
  89. /**
  90. * To force id = 1 in load fixtures.
  91. *
  92. * @param int $id
  93. *
  94. * @return $this
  95. */
  96. public function setId($id)
  97. {
  98. $this->id = $id;
  99. return $this;
  100. }
  101. /**
  102. * Get id.
  103. *
  104. * @return int
  105. */
  106. public function getId()
  107. {
  108. return $this->id;
  109. }
  110. /**
  111. * Add collections.
  112. *
  113. * @return $this
  114. */
  115. public function addCollection(CollectionInterface $collections)
  116. {
  117. $this->collections->add($collections);
  118. return $this;
  119. }
  120. /**
  121. * Remove collections.
  122. *
  123. * @return $this
  124. */
  125. public function removeCollection(CollectionInterface $collections)
  126. {
  127. $this->collections->removeElement($collections);
  128. return $this;
  129. }
  130. /**
  131. * Get collections.
  132. *
  133. * @return DoctrineCollection<int, CollectionInterface>
  134. */
  135. public function getCollections()
  136. {
  137. return $this->collections;
  138. }
  139. /**
  140. * Set key.
  141. *
  142. * @param string $key
  143. *
  144. * @return $this
  145. */
  146. public function setKey($key)
  147. {
  148. $this->key = $key;
  149. return $this;
  150. }
  151. /**
  152. * Get key.
  153. *
  154. * @return string|null
  155. */
  156. public function getKey()
  157. {
  158. return $this->key;
  159. }
  160. }