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