vendor/sulu/sulu/src/Sulu/Bundle/RouteBundle/Entity/Route.php line 28

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\RouteBundle\Entity;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use JMS\Serializer\Annotation\ExclusionPolicy;
  14. use JMS\Serializer\Annotation\Expose;
  15. use JMS\Serializer\Annotation\VirtualProperty;
  16. use Sulu\Bundle\RouteBundle\Model\RouteInterface;
  17. use Sulu\Component\Persistence\Model\AuditableInterface;
  18. use Sulu\Component\Persistence\Model\AuditableTrait;
  19. /**
  20. * Represents a concrete route in the route-pool.
  21. *
  22. * @ExclusionPolicy("all")
  23. */
  24. class Route implements RouteInterface, AuditableInterface
  25. {
  26. use AuditableTrait;
  27. /**
  28. * @var int
  29. *
  30. * @Expose
  31. */
  32. private $id;
  33. /**
  34. * @var string
  35. *
  36. * @Expose
  37. */
  38. private $path;
  39. /**
  40. * @var string
  41. *
  42. * @Expose
  43. */
  44. private $locale;
  45. /**
  46. * @var string
  47. */
  48. private $entityClass;
  49. /**
  50. * @var string
  51. */
  52. private $entityId;
  53. /**
  54. * @var bool
  55. *
  56. * @Expose
  57. */
  58. private $history = false;
  59. /**
  60. * @var RouteInterface|null
  61. */
  62. private $target;
  63. /**
  64. * @var Collection<int, RouteInterface>
  65. */
  66. protected $histories;
  67. /**
  68. * @param string $path
  69. * @param string $entityId
  70. * @param string $entityClass
  71. * @param string $locale
  72. */
  73. public function __construct($path = null, $entityId = null, $entityClass = null, $locale = null)
  74. {
  75. $this->path = $path;
  76. $this->entityId = $entityId;
  77. $this->entityClass = $entityClass;
  78. $this->locale = $locale;
  79. $this->histories = new ArrayCollection();
  80. }
  81. public function getId()
  82. {
  83. return $this->id;
  84. }
  85. public function setPath($path)
  86. {
  87. $this->path = $path;
  88. return $this;
  89. }
  90. public function getPath()
  91. {
  92. return $this->path;
  93. }
  94. public function setLocale($locale)
  95. {
  96. $this->locale = $locale;
  97. return $this;
  98. }
  99. public function getLocale()
  100. {
  101. return $this->locale;
  102. }
  103. public function getEntityClass()
  104. {
  105. return $this->entityClass;
  106. }
  107. public function setEntityClass($entityClass)
  108. {
  109. $this->entityClass = $entityClass;
  110. return $this;
  111. }
  112. public function getEntityId()
  113. {
  114. return $this->entityId;
  115. }
  116. public function setEntityId($entityId)
  117. {
  118. $this->entityId = $entityId;
  119. return $this;
  120. }
  121. public function isHistory()
  122. {
  123. return $this->history;
  124. }
  125. public function setHistory($history)
  126. {
  127. $this->history = $history;
  128. return $this;
  129. }
  130. public function getTarget()
  131. {
  132. return $this->target;
  133. }
  134. public function setTarget(?RouteInterface $target = null)
  135. {
  136. $this->target = $target;
  137. return $this;
  138. }
  139. public function removeTarget()
  140. {
  141. $this->target = null;
  142. return $this;
  143. }
  144. public function getHistories()
  145. {
  146. return $this->histories;
  147. }
  148. public function addHistory(RouteInterface $history)
  149. {
  150. $this->histories[] = $history;
  151. return $this;
  152. }
  153. /**
  154. * @VirtualProperty
  155. */
  156. public function getCreated()
  157. {
  158. return $this->created;
  159. }
  160. /**
  161. * @VirtualProperty
  162. */
  163. public function getResourcelocator()
  164. {
  165. return $this->path;
  166. }
  167. }