]> Raphaƫl G. Git Repositories - userbundle/blob - Entity/Group.php
Add manifest, licence, readme and composer files
[userbundle] / Entity / Group.php
1 <?php
2
3 // src/Rapsys/UserBundle/Entity/Group.php
4 namespace Rapsys\UserBundle\Entity;
5
6 class Group extends \Symfony\Component\Security\Core\Role\Role {
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($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 * Set created
65 *
66 * @param \DateTime $created
67 *
68 * @return User
69 */
70 public function setCreated($created) {
71 $this->created = $created;
72
73 return $this;
74 }
75
76 /**
77 * Get created
78 *
79 * @return \DateTime
80 */
81 public function getCreated() {
82 return $this->created;
83 }
84
85 /**
86 * Set updated
87 *
88 * @param \DateTime $updated
89 *
90 * @return User
91 */
92 public function setUpdated($updated) {
93 $this->updated = $updated;
94
95 return $this;
96 }
97
98 /**
99 * Get updated
100 *
101 * @return \DateTime
102 */
103 public function getUpdated() {
104 return $this->updated;
105 }
106
107 /**
108 * Add user
109 *
110 * @param \Rapsys\UserBundle\Entity\User $user
111 *
112 * @return Group
113 */
114 public function addUser(\Rapsys\UserBundle\Entity\User $user) {
115 $this->users[] = $user;
116
117 return $this;
118 }
119
120 /**
121 * Remove user
122 *
123 * @param \Rapsys\UserBundle\Entity\User $user
124 */
125 public function removeUser(\Rapsys\UserBundle\Entity\User $user) {
126 $this->users->removeElement($user);
127 }
128
129 /**
130 * Get users
131 *
132 * @return \Doctrine\Common\Collections\Collection
133 */
134 public function getUsers() {
135 return $this->users;
136 }
137 }