vendor/uvdesk/core-framework/Entity/SupportPrivilege.php line 13

Open in your IDE?
  1. <?php
  2. namespace Webkul\UVDesk\CoreFrameworkBundle\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. /**
  5. * SupportPrivilege
  6. * @ORM\Entity(repositoryClass="Webkul\UVDesk\CoreFrameworkBundle\Repository\SupportPrivilegeRepository")
  7. * @ORM\HasLifecycleCallbacks
  8. * @ORM\Table(name="uv_support_privilege")
  9. */
  10. class SupportPrivilege
  11. {
  12. /**
  13. * @var integer
  14. * @ORM\Id()
  15. * @ORM\Column(type="integer")
  16. * @ORM\GeneratedValue(strategy="AUTO")
  17. */
  18. private $id;
  19. /**
  20. * @var string
  21. * @ORM\Column(type="string", length=191)
  22. */
  23. private $name;
  24. /**
  25. * @var string
  26. * @ORM\Column(type="text")
  27. */
  28. private $description;
  29. /**
  30. * @var array
  31. * @ORM\Column(type="array", nullable=true)
  32. */
  33. private $privileges;
  34. /**
  35. * @var \DateTime
  36. * @ORM\Column(type="datetime", nullable=true)
  37. */
  38. private $createdAt;
  39. /**
  40. * @var \Doctrine\Common\Collections\Collection
  41. * @ORM\ManyToMany(targetEntity="UserInstance", mappedBy="supportPrivileges")
  42. */
  43. private $users;
  44. /**
  45. * Constructor
  46. */
  47. public function __construct()
  48. {
  49. $this->users = new \Doctrine\Common\Collections\ArrayCollection();
  50. }
  51. /**
  52. * Get id
  53. *
  54. * @return integer
  55. */
  56. public function getId()
  57. {
  58. return $this->id;
  59. }
  60. /**
  61. * Set name
  62. *
  63. * @param string $name
  64. *
  65. * @return SupportPrivilege
  66. */
  67. public function setName($name)
  68. {
  69. $this->name = $name;
  70. return $this;
  71. }
  72. /**
  73. * Get name
  74. *
  75. * @return string
  76. */
  77. public function getName()
  78. {
  79. return $this->name;
  80. }
  81. /**
  82. * Set description
  83. *
  84. * @param string $description
  85. *
  86. * @return SupportPrivilege
  87. */
  88. public function setDescription($description)
  89. {
  90. $this->description = $description;
  91. return $this;
  92. }
  93. /**
  94. * Get description
  95. *
  96. * @return string
  97. */
  98. public function getDescription()
  99. {
  100. return $this->description;
  101. }
  102. /**
  103. * Set privileges
  104. *
  105. * @param array $privileges
  106. *
  107. * @return SupportPrivilege
  108. */
  109. public function setPrivileges($privileges)
  110. {
  111. $this->privileges = $privileges;
  112. return $this;
  113. }
  114. /**
  115. * Get privileges
  116. *
  117. * @return array
  118. */
  119. public function getPrivileges()
  120. {
  121. return $this->privileges;
  122. }
  123. /**
  124. * Set createdAt
  125. *
  126. * @param \DateTime $createdAt
  127. *
  128. * @return SupportPrivilege
  129. */
  130. public function setCreatedAt($createdAt)
  131. {
  132. $this->createdAt = $createdAt;
  133. return $this;
  134. }
  135. /**
  136. * Get createdAt
  137. *
  138. * @return \DateTime
  139. */
  140. public function getCreatedAt()
  141. {
  142. return $this->createdAt;
  143. }
  144. /**
  145. * Add user
  146. *
  147. * @param \Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance $user
  148. *
  149. * @return SupportPrivilege
  150. */
  151. public function addUser(\Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance $user)
  152. {
  153. $this->users[] = $user;
  154. return $this;
  155. }
  156. /**
  157. * Remove user
  158. *
  159. * @param \Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance $user
  160. */
  161. public function removeUser(\Webkul\UVDesk\CoreFrameworkBundle\Entity\UserInstance $user)
  162. {
  163. $this->users->removeElement($user);
  164. }
  165. /**
  166. * Get users
  167. *
  168. * @return \Doctrine\Common\Collections\Collection
  169. */
  170. public function getUsers()
  171. {
  172. return $this->users;
  173. }
  174. /**
  175. * @ORM\PrePersist
  176. */
  177. public function initializeTimestamp()
  178. {
  179. $this->createdAt = new \DateTime('now');
  180. }
  181. }