vendor/sulu/sulu/src/Sulu/Bundle/SecurityBundle/Entity/UserGroup.php line 22

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 JMS\Serializer\Annotation\SerializedName;
  12. use JMS\Serializer\Annotation\VirtualProperty;
  13. use Sulu\Bundle\CoreBundle\Entity\ApiEntity;
  14. use Sulu\Component\Security\Authentication\UserInterface;
  15. /**
  16. * @deprecated The group functionality was deprecated in Sulu 2.1 and will be removed in Sulu 3.0
  17. */
  18. class UserGroup extends ApiEntity
  19. {
  20. /**
  21. * @var string
  22. */
  23. private $locale;
  24. /**
  25. * @var int
  26. */
  27. private $id;
  28. /**
  29. * @var UserInterface|null
  30. */
  31. private $user;
  32. /**
  33. * @var Group|null
  34. */
  35. private $group;
  36. /**
  37. * Set locale.
  38. *
  39. * @param string $locale
  40. *
  41. * @return UserGroup
  42. */
  43. public function setLocale($locale)
  44. {
  45. $this->locale = $locale;
  46. return $this;
  47. }
  48. /**
  49. * Get locale.
  50. *
  51. * @return string
  52. */
  53. public function getLocale()
  54. {
  55. return $this->locale;
  56. }
  57. /**
  58. * Get Locales as array.
  59. *
  60. * @return array
  61. */
  62. #[VirtualProperty]
  63. #[SerializedName('locales')]
  64. public function getLocales()
  65. {
  66. return \json_decode($this->locale);
  67. }
  68. /**
  69. * Get id.
  70. *
  71. * @return int
  72. */
  73. public function getId()
  74. {
  75. return $this->id;
  76. }
  77. /**
  78. * Set user.
  79. *
  80. * @return UserGroup
  81. */
  82. public function setUser(?UserInterface $user = null)
  83. {
  84. $this->user = $user;
  85. return $this;
  86. }
  87. /**
  88. * Get user.
  89. *
  90. * @return UserInterface|null
  91. */
  92. public function getUser()
  93. {
  94. return $this->user;
  95. }
  96. /**
  97. * Set group.
  98. *
  99. * @return UserGroup
  100. */
  101. public function setGroup(?Group $group = null)
  102. {
  103. $this->group = $group;
  104. return $this;
  105. }
  106. /**
  107. * Get group.
  108. *
  109. * @return Group|null
  110. */
  111. public function getGroup()
  112. {
  113. return $this->group;
  114. }
  115. }