]> Raphaël G. Git Repositories - airbundle/blob - Entity/User.php
New page title schema
[airbundle] / Entity / User.php
1 <?php declare(strict_types=1);
2
3 /*
4 * this file is part of the rapsys packbundle package.
5 *
6 * (c) raphaël gertz <symfony@rapsys.eu>
7 *
8 * for the full copyright and license information, please view the license
9 * file that was distributed with this source code.
10 */
11
12 namespace Rapsys\AirBundle\Entity;
13
14 use Doctrine\Common\Collections\ArrayCollection;
15
16 use Rapsys\AirBundle\Entity\Application;
17 use Rapsys\AirBundle\Entity\Group;
18 use Rapsys\AirBundle\Entity\Link;
19 use Rapsys\AirBundle\Entity\Snippet;
20 use Rapsys\UserBundle\Entity\User as BaseUser;
21
22 class User extends BaseUser {
23 /**
24 * @var string
25 */
26 protected $pseudonym;
27
28 /**
29 * @var string
30 */
31 protected $phone;
32
33 /**
34 * @var string
35 */
36 protected $slug;
37
38 /**
39 * @var ArrayCollection
40 */
41 private $applications;
42
43 /**
44 * @var ArrayCollection
45 */
46 private $dances;
47
48 /**
49 * @var ArrayCollection
50 */
51 private $locations;
52
53 /**
54 * @var ArrayCollection
55 */
56 private $snippets;
57
58 /**
59 * @var ArrayCollection
60 */
61 private $subscribers;
62
63 /**
64 * @var ArrayCollection
65 */
66 private $subscriptions;
67
68 /**
69 * Constructor
70 *
71 * @param string $mail The user mail
72 */
73 public function __construct(string $mail) {
74 //Call parent constructor
75 parent::__construct($mail);
76
77 //Set defaults
78 $this->pseudonym = null;
79 $this->phone = null;
80 $this->slug = null;
81
82 //Set collections
83 $this->applications = new ArrayCollection();
84 $this->dances = new ArrayCollection();
85 $this->locations = new ArrayCollection();
86 $this->snippets = new ArrayCollection();
87 $this->subscribers = new ArrayCollection();
88 $this->subscriptions = new ArrayCollection();
89 }
90
91 /**
92 * Set pseudonym
93 *
94 * @param string $pseudonym
95 *
96 * @return User
97 */
98 public function setPseudonym(?string $pseudonym): User {
99 $this->pseudonym = $pseudonym;
100
101 return $this;
102 }
103
104 /**
105 * Get pseudonym
106 *
107 * @return string
108 */
109 public function getPseudonym(): ?string {
110 return $this->pseudonym;
111 }
112
113 /**
114 * Set phone
115 *
116 * @param string $phone
117 *
118 * @return User
119 */
120 public function setPhone(?string $phone): User {
121 $this->phone = $phone;
122
123 return $this;
124 }
125
126 /**
127 * Get phone
128 *
129 * @return string
130 */
131 public function getPhone(): ?string {
132 return $this->phone;
133 }
134
135 /**
136 * Set slug
137 *
138 * @param string $slug
139 *
140 * @return User
141 */
142 public function setSlug(?string $slug): User {
143 $this->slug = $slug;
144
145 return $this;
146 }
147
148 /**
149 * Get slug
150 *
151 * @return string
152 */
153 public function getSlug(): ?string {
154 return $this->slug;
155 }
156
157 /**
158 * Add application
159 *
160 * @param Application $application
161 *
162 * @return User
163 */
164 public function addApplication(Application $application): User {
165 $this->applications[] = $application;
166
167 return $this;
168 }
169
170 /**
171 * Remove application
172 *
173 * @param Application $application
174 */
175 public function removeApplication(Application $application): bool {
176 return $this->applications->removeElement($application);
177 }
178
179 /**
180 * Get applications
181 *
182 * @return ArrayCollection
183 */
184 public function getApplications(): ArrayCollection {
185 return $this->applications;
186 }
187
188 /**
189 * Add snippet
190 *
191 * @param Snippet $snippet
192 *
193 * @return User
194 */
195 public function addSnippet(Snippet $snippet): User {
196 $this->snippets[] = $snippet;
197
198 return $this;
199 }
200
201 /**
202 * Remove snippet
203 *
204 * @param Snippet $snippet
205 */
206 public function removeSnippet(Snippet $snippet): bool {
207 return $this->snippets->removeElement($snippet);
208 }
209
210 /**
211 * Get snippets
212 *
213 * @return ArrayCollection
214 */
215 public function getSnippets(): ArrayCollection {
216 return $this->snippets;
217 }
218
219 /**
220 * Add dance
221 *
222 * @param Dance $dance
223 *
224 * @return User
225 */
226 public function addDance(Dance $dance): User {
227 $this->dances[] = $dance;
228
229 return $this;
230 }
231
232 /**
233 * Remove dance
234 *
235 * @param Dance $dance
236 *
237 * @return bool
238 */
239 public function removeDance(Dance $dance): bool {
240 return $this->dances->removeElement($dance);
241 }
242
243 /**
244 * Get dances
245 *
246 * @return ArrayCollection
247 */
248 public function getDances(): ArrayCollection {
249 return $this->dances;
250 }
251
252 /**
253 * Add location
254 *
255 * @param Location $location
256 *
257 * @return User
258 */
259 public function addLocation(Location $location): User {
260 $this->locations[] = $location;
261
262 return $this;
263 }
264
265 /**
266 * Remove location
267 *
268 * @param Location $location
269 */
270 public function removeLocation(Location $location): bool {
271 return $this->locations->removeElement($location);
272 }
273
274 /**
275 * Get locations
276 *
277 * @return ArrayCollection
278 */
279 public function getLocations(): ArrayCollection {
280 return $this->locations;
281 }
282
283 /**
284 * Add subscriber
285 *
286 * @param User $subscriber
287 *
288 * @return User
289 */
290 public function addSubscriber(User $subscriber): User {
291 $this->subscribers[] = $subscriber;
292
293 return $this;
294 }
295
296 /**
297 * Remove subscriber
298 *
299 * @param User $subscriber
300 */
301 public function removeSubscriber(User $subscriber): bool {
302 return $this->subscribers->removeElement($subscriber);
303 }
304
305 /**
306 * Get subscribers
307 *
308 * @return ArrayCollection
309 */
310 public function getSubscribers(): ArrayCollection {
311 return $this->subscribers;
312 }
313
314 /**
315 * Add subscription
316 *
317 * @param User $subscription
318 *
319 * @return User
320 */
321 public function addSubscription(User $subscription): User {
322 $this->subscriptions[] = $subscription;
323
324 return $this;
325 }
326
327 /**
328 * Remove subscription
329 *
330 * @param User $subscription
331 */
332 public function removeSubscription(User $subscription): bool {
333 return $this->subscriptions->removeElement($subscription);
334 }
335
336 /**
337 * Get subscriptions
338 *
339 * @return ArrayCollection
340 */
341 public function getSubscriptions(): ArrayCollection {
342 return $this->subscriptions;
343 }
344 }