vendor/sulu/sulu/src/Sulu/Bundle/SecurityBundle/Entity/Group.php line 26

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\SecurityBundle\Entity;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use JMS\Serializer\Annotation\Exclude;
  14. use Sulu\Bundle\CoreBundle\Entity\ApiEntity;
  15. use Sulu\Component\Persistence\Model\AuditableInterface;
  16. use Sulu\Component\Persistence\Model\AuditableTrait;
  17. use Sulu\Component\Security\Authentication\RoleInterface;
  18. use Sulu\Component\Security\Authentication\UserInterface;
  19. /**
  20. * @deprecated The group functionality was deprecated in Sulu 2.1 and will be removed in Sulu 3.0
  21. */
  22. class Group extends ApiEntity implements AuditableInterface
  23. {
  24. use AuditableTrait;
  25. /**
  26. * @var int
  27. */
  28. #[Exclude]
  29. private $lft;
  30. /**
  31. * @var int
  32. */
  33. #[Exclude]
  34. private $rgt;
  35. /**
  36. * @var int
  37. */
  38. #[Exclude]
  39. private $depth;
  40. /**
  41. * @var string
  42. */
  43. private $name;
  44. /**
  45. * @var int
  46. */
  47. private $id;
  48. /**
  49. * @var Collection<int, self>
  50. */
  51. private $children;
  52. /**
  53. * @var Collection<int, UserGroup>
  54. */
  55. private $userGroups;
  56. /**
  57. * @var Group|null
  58. */
  59. private $parent;
  60. /**
  61. * @var Collection<int, RoleInterface>
  62. */
  63. private $roles;
  64. /**
  65. * @var UserInterface|null
  66. */
  67. #[Exclude]
  68. protected $changer;
  69. /**
  70. * @var UserInterface|null
  71. */
  72. #[Exclude]
  73. protected $creator;
  74. public function __construct()
  75. {
  76. $this->children = new ArrayCollection();
  77. $this->userGroups = new ArrayCollection();
  78. $this->roles = new ArrayCollection();
  79. }
  80. /**
  81. * Set lft.
  82. *
  83. * @param int $lft
  84. *
  85. * @return Group
  86. */
  87. public function setLft($lft)
  88. {
  89. $this->lft = $lft;
  90. return $this;
  91. }
  92. /**
  93. * Get lft.
  94. *
  95. * @return int
  96. */
  97. public function getLft()
  98. {
  99. return $this->lft;
  100. }
  101. /**
  102. * Set rgt.
  103. *
  104. * @param int $rgt
  105. *
  106. * @return Group
  107. */
  108. public function setRgt($rgt)
  109. {
  110. $this->rgt = $rgt;
  111. return $this;
  112. }
  113. /**
  114. * Get rgt.
  115. *
  116. * @return int
  117. */
  118. public function getRgt()
  119. {
  120. return $this->rgt;
  121. }
  122. /**
  123. * Set depth.
  124. *
  125. * @param int $depth
  126. *
  127. * @return Group
  128. */
  129. public function setDepth($depth)
  130. {
  131. $this->depth = $depth;
  132. return $this;
  133. }
  134. /**
  135. * Get depth.
  136. *
  137. * @return int
  138. */
  139. public function getDepth()
  140. {
  141. return $this->depth;
  142. }
  143. /**
  144. * Set name.
  145. *
  146. * @param string $name
  147. *
  148. * @return Group
  149. */
  150. public function setName($name)
  151. {
  152. $this->name = $name;
  153. return $this;
  154. }
  155. /**
  156. * Get name.
  157. *
  158. * @return string
  159. */
  160. public function getName()
  161. {
  162. return $this->name;
  163. }
  164. /**
  165. * Get id.
  166. *
  167. * @return int
  168. */
  169. public function getId()
  170. {
  171. return $this->id;
  172. }
  173. /**
  174. * Add children.
  175. *
  176. * @return Group
  177. */
  178. public function addChildren(self $children)
  179. {
  180. $this->children[] = $children;
  181. return $this;
  182. }
  183. /**
  184. * Remove children.
  185. *
  186. * @return void
  187. */
  188. public function removeChildren(self $children)
  189. {
  190. $this->children->removeElement($children);
  191. }
  192. /**
  193. * Get children.
  194. *
  195. * @return Collection<int, self>
  196. */
  197. public function getChildren()
  198. {
  199. return $this->children;
  200. }
  201. /**
  202. * Add userGroups.
  203. *
  204. * @return Group
  205. */
  206. public function addUserGroup(UserGroup $userGroups)
  207. {
  208. $this->userGroups[] = $userGroups;
  209. return $this;
  210. }
  211. /**
  212. * Remove userGroups.
  213. *
  214. * @return void
  215. */
  216. public function removeUserGroup(UserGroup $userGroups)
  217. {
  218. $this->userGroups->removeElement($userGroups);
  219. }
  220. /**
  221. * Get userGroups.
  222. *
  223. * @return Collection<int, UserGroup>
  224. */
  225. public function getUserGroups()
  226. {
  227. return $this->userGroups;
  228. }
  229. /**
  230. * Set parent.
  231. *
  232. * @return Group
  233. */
  234. public function setParent(?self $parent = null)
  235. {
  236. $this->parent = $parent;
  237. return $this;
  238. }
  239. /**
  240. * Get parent.
  241. *
  242. * @return Group|null
  243. */
  244. public function getParent()
  245. {
  246. return $this->parent;
  247. }
  248. /**
  249. * Add roles.
  250. *
  251. * @return Group
  252. */
  253. public function addRole(RoleInterface $roles)
  254. {
  255. $this->roles[] = $roles;
  256. return $this;
  257. }
  258. /**
  259. * Remove roles.
  260. *
  261. * @return void
  262. */
  263. public function removeRole(RoleInterface $roles)
  264. {
  265. $this->roles->removeElement($roles);
  266. }
  267. /**
  268. * Get roles.
  269. *
  270. * @return Collection<int, RoleInterface>
  271. */
  272. public function getRoles()
  273. {
  274. return $this->roles;
  275. }
  276. }