1 | <?php |
||
21 | class Group implements RoleInterface, GroupInterface |
||
|
|||
22 | { |
||
23 | /** |
||
24 | * @ORM\Id |
||
25 | * @ORM\Column(type="integer") |
||
26 | * @ORM\GeneratedValue(strategy="AUTO") |
||
27 | */ |
||
28 | protected $id; |
||
29 | |||
30 | /** |
||
31 | * @Assert\NotBlank() |
||
32 | * @ORM\Column(type="string") |
||
33 | */ |
||
34 | protected $name; |
||
35 | |||
36 | /** |
||
37 | * @ORM\ManyToMany(targetEntity="Role") |
||
38 | * @ORM\JoinTable(name="kuma_groups_roles", |
||
39 | * joinColumns={@ORM\JoinColumn(name="group_id", referencedColumnName="id")}, |
||
40 | * inverseJoinColumns={@ORM\JoinColumn(name="role_id", referencedColumnName="id")} |
||
41 | * ) |
||
42 | */ |
||
43 | protected $roles; |
||
44 | |||
45 | /** |
||
46 | * Construct a new group |
||
47 | * |
||
48 | * @param string $name Name of the group |
||
49 | */ |
||
50 | public function __construct($name = '') |
||
55 | |||
56 | /** |
||
57 | * Get id |
||
58 | * |
||
59 | * @return int |
||
60 | */ |
||
61 | public function getId() |
||
65 | |||
66 | /** |
||
67 | * Get string representation of object |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | public function __toString() |
||
75 | |||
76 | /** |
||
77 | * Returns an array of strings (needed because Symfony ACL doesn't support using RoleInterface yet) |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | public function getRoles() |
||
91 | |||
92 | /** |
||
93 | * Returns the true ArrayCollection of Roles. |
||
94 | * |
||
95 | * @return ArrayCollection |
||
96 | */ |
||
97 | public function getRolesCollection() |
||
101 | |||
102 | /** |
||
103 | * Pass a string, get the desired Role object or null. |
||
104 | * |
||
105 | * @param string $role |
||
106 | * |
||
107 | * @return Role|null |
||
108 | */ |
||
109 | public function getRole($role = null) |
||
120 | |||
121 | /** |
||
122 | * Pass a string, checks if we have that Role. Same functionality as getRole() except it returns a boolean. |
||
123 | * |
||
124 | * @param string $role |
||
125 | * |
||
126 | * @return bool |
||
127 | */ |
||
128 | public function hasRole($role) |
||
136 | |||
137 | /** |
||
138 | * Adds a Role object to the ArrayCollection. Can't type hint due to interface so throws Exception. |
||
139 | * |
||
140 | * @param Role $role |
||
141 | * |
||
142 | * @return GroupInterface |
||
143 | * @throws InvalidArgumentException |
||
144 | */ |
||
145 | public function addRole($role) |
||
157 | |||
158 | /** |
||
159 | * Pass a string, remove the Role object from collection. |
||
160 | * |
||
161 | * @param string $role |
||
162 | * |
||
163 | * @return GroupInterface |
||
164 | */ |
||
165 | public function removeRole($role) |
||
174 | |||
175 | /** |
||
176 | * Pass an ARRAY of Role objects and will clear the collection and re-set it with new Roles. |
||
177 | * |
||
178 | * @param Role[] $roles array of Role objects. |
||
179 | * |
||
180 | * @return GroupInterface |
||
181 | */ |
||
182 | public function setRoles(array $roles) |
||
191 | |||
192 | /** |
||
193 | * Directly set the ArrayCollection of Roles. Type hinted as Collection which is the parent of (Array|Persistent)Collection. |
||
194 | * |
||
195 | * @param Collection $collection |
||
196 | * |
||
197 | * @return GroupInterface |
||
198 | */ |
||
199 | public function setRolesCollection(Collection $collection) |
||
205 | |||
206 | /** |
||
207 | * Return the name of the group |
||
208 | * |
||
209 | * @return string |
||
210 | */ |
||
211 | public function getName() |
||
215 | |||
216 | /** |
||
217 | * Set the name of the group |
||
218 | * |
||
219 | * @param string $name New name of the group |
||
220 | * |
||
221 | * @return GroupInterface |
||
222 | */ |
||
223 | public function setName($name) |
||
229 | |||
230 | /** |
||
231 | * @Assert\Callback |
||
232 | * |
||
233 | * @param ExecutionContextInterface $context |
||
234 | */ |
||
235 | public function isGroupValid(ExecutionContextInterface $context) |
||
244 | } |
||
245 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.