]> Raphaƫl G. Git Repositories - userbundle/blob - Entity/Group.php
dad79b0132c1a17902541465aa54d317211df0af
[userbundle] / Entity / Group.php
1 <?php
2
3 // src/Rapsys/UserBundle/Entity/Group.php
4 namespace Rapsys\UserBundle\Entity;
5
6 class Group {
7 /**
8 * @var integer
9 */
10 protected $id;
11
12 /**
13 * @var string
14 */
15 protected $role;
16
17 /**
18 * @var \DateTime
19 */
20 protected $created;
21
22 /**
23 * @var \DateTime
24 */
25 protected $updated;
26
27 /**
28 * @var \Doctrine\Common\Collections\Collection
29 */
30 protected $users;
31
32 /**
33 * Constructor
34 * @param string $role The role name
35 */
36 public function __construct(string $role) {
37 $this->role = (string) $role;
38 $this->users = new \Doctrine\Common\Collections\ArrayCollection();
39 }
40
41 /**
42 * Set role
43 *
44 * @param string $role
45 *
46 * @return User
47 */
48 public function setRole($role) {
49 $this->role = $role;
50
51 return $this;
52 }
53
54 /**
55 * Get role
56 *
57 * @return string
58 */
59 public function getRole() {
60 return $this->role;
61 }
62
63 /**
64 * Returns a string representation of the role.
65 *
66 * @xxx Replace the deprecated "extends \Symfony\Component\Security\Core\Role\Role"
67 *
68 * @return string
69 */
70 public function __toString(): string {
71 return $this->role;
72 }
73
74 /**
75 * Set created
76 *
77 * @param \DateTime $created
78 *
79 * @return User
80 */
81 public function setCreated($created) {
82 $this->created = $created;
83
84 return $this;
85 }
86
87 /**
88 * Get created
89 *
90 * @return \DateTime
91 */
92 public function getCreated() {
93 return $this->created;
94 }
95
96 /**
97 * Set updated
98 *
99 * @param \DateTime $updated
100 *
101 * @return User
102 */
103 public function setUpdated($updated) {
104 $this->updated = $updated;
105
106 return $this;
107 }
108
109 /**
110 * Get updated
111 *
112 * @return \DateTime
113 */
114 public function getUpdated() {
115 return $this->updated;
116 }
117
118 /**
119 * Add user
120 *
121 * @param \Rapsys\UserBundle\Entity\User $user
122 *
123 * @return Group
124 */
125 public function addUser(\Rapsys\UserBundle\Entity\User $user) {
126 $this->users[] = $user;
127
128 return $this;
129 }
130
131 /**
132 * Remove user
133 *
134 * @param \Rapsys\UserBundle\Entity\User $user
135 */
136 public function removeUser(\Rapsys\UserBundle\Entity\User $user) {
137 $this->users->removeElement($user);
138 }
139
140 /**
141 * Get users
142 *
143 * @return \Doctrine\Common\Collections\Collection
144 */
145 public function getUsers() {
146 return $this->users;
147 }
148 }