]> Raphaël G. Git Repositories - airbundle/blob - Entity/User.php
5738c3aa6f93fc00fcf313cf460b8352df462404
[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\UserBundle\Entity\User as BaseUser;
17
18 class User extends BaseUser {
19 /**
20 * @var string
21 */
22 protected $city;
23
24 /**
25 * @var string
26 */
27 protected $phone;
28
29 /**
30 * @var Country
31 */
32 protected $country;
33
34 /**
35 * @var string
36 */
37 protected $pseudonym;
38
39 /**
40 * @var string
41 */
42 protected $zipcode;
43
44 /**
45 * @var ArrayCollection
46 */
47 private $applications;
48
49 /**
50 * @var ArrayCollection
51 */
52 private $dances;
53
54 /**
55 * @var ArrayCollection
56 */
57 private $locations;
58
59 /**
60 * @var ArrayCollection
61 */
62 private $snippets;
63
64 /**
65 * @var ArrayCollection
66 */
67 private $subscribers;
68
69 /**
70 * @var ArrayCollection
71 */
72 private $subscriptions;
73
74 /**
75 * Constructor
76 *
77 * @param string $mail The user mail
78 */
79 public function __construct(string $mail) {
80 //Call parent constructor
81 parent::__construct($mail);
82
83 //Set defaults
84 $this->city = null;
85 $this->country = null;
86 $this->phone = null;
87 $this->pseudonym = null;
88 $this->zipcode = null;
89
90 //Set collections
91 $this->applications = new ArrayCollection();
92 $this->dances = new ArrayCollection();
93 $this->locations = new ArrayCollection();
94 $this->snippets = new ArrayCollection();
95 $this->subscribers = new ArrayCollection();
96 $this->subscriptions = new ArrayCollection();
97 }
98
99 /**
100 * Set country
101 *
102 * @param Country $country
103 *
104 * @return User
105 */
106 public function setCountry(Country $country) {
107 $this->country = $country;
108
109 return $this;
110 }
111
112 /**
113 * Get country
114 *
115 * @return Country
116 */
117 public function getCountry() {
118 return $this->country;
119 }
120
121 /**
122 * Set city
123 *
124 * @param string $city
125 *
126 * @return User
127 */
128 public function setCity(?string $city): User {
129 $this->city = $city;
130
131 return $this;
132 }
133
134 /**
135 * Get city
136 *
137 * @return string
138 */
139 public function getCity(): ?string {
140 return $this->city;
141 }
142
143 /**
144 * Set phone
145 *
146 * @param string $phone
147 *
148 * @return User
149 */
150 public function setPhone(?string $phone): User {
151 $this->phone = $phone;
152
153 return $this;
154 }
155
156 /**
157 * Get phone
158 *
159 * @return string
160 */
161 public function getPhone(): ?string {
162 return $this->phone;
163 }
164
165 /**
166 * Set pseudonym
167 *
168 * @param string $pseudonym
169 *
170 * @return User
171 */
172 public function setPseudonym(?string $pseudonym): User {
173 $this->pseudonym = $pseudonym;
174
175 return $this;
176 }
177
178 /**
179 * Get pseudonym
180 *
181 * @return string
182 */
183 public function getPseudonym(): ?string {
184 return $this->pseudonym;
185 }
186
187 /**
188 * Set zipcode
189 *
190 * @param string $zipcode
191 *
192 * @return User
193 */
194 public function setZipcode(?string $zipcode): User {
195 $this->zipcode = $zipcode;
196
197 return $this;
198 }
199
200 /**
201 * Get zipcode
202 *
203 * @return string
204 */
205 public function getZipcode(): ?string {
206 return $this->zipcode;
207 }
208
209 /**
210 * Add application
211 *
212 * @param Application $application
213 *
214 * @return User
215 */
216 public function addApplication(Application $application): User {
217 $this->applications[] = $application;
218
219 return $this;
220 }
221
222 /**
223 * Remove application
224 *
225 * @param Application $application
226 */
227 public function removeApplication(Application $application): bool {
228 return $this->applications->removeElement($application);
229 }
230
231 /**
232 * Get applications
233 *
234 * @return ArrayCollection
235 */
236 public function getApplications(): ArrayCollection {
237 return $this->applications;
238 }
239
240 /**
241 * Add dance
242 *
243 * @param Dance $dance
244 *
245 * @return User
246 */
247 public function addDance(Dance $dance): User {
248 $this->dances[] = $dance;
249
250 return $this;
251 }
252
253 /**
254 * Remove dance
255 *
256 * @param Dance $dance
257 *
258 * @return bool
259 */
260 public function removeDance(Dance $dance): bool {
261 return $this->dances->removeElement($dance);
262 }
263
264 /**
265 * Get dances
266 *
267 * @return ArrayCollection
268 */
269 public function getDances(): ArrayCollection {
270 return $this->dances;
271 }
272
273 /**
274 * Add location
275 *
276 * @param Location $location
277 *
278 * @return User
279 */
280 public function addLocation(Location $location): User {
281 $this->locations[] = $location;
282
283 return $this;
284 }
285
286 /**
287 * Remove location
288 *
289 * @param Location $location
290 */
291 public function removeLocation(Location $location): bool {
292 return $this->locations->removeElement($location);
293 }
294
295 /**
296 * Get locations
297 *
298 * @return ArrayCollection
299 */
300 public function getLocations(): ArrayCollection {
301 return $this->locations;
302 }
303
304 /**
305 * Add snippet
306 *
307 * @param Snippet $snippet
308 *
309 * @return User
310 */
311 public function addSnippet(Snippet $snippet): User {
312 $this->snippets[] = $snippet;
313
314 return $this;
315 }
316
317 /**
318 * Remove snippet
319 *
320 * @param Snippet $snippet
321 */
322 public function removeSnippet(Snippet $snippet): bool {
323 return $this->snippets->removeElement($snippet);
324 }
325
326 /**
327 * Get snippets
328 *
329 * @return ArrayCollection
330 */
331 public function getSnippets(): ArrayCollection {
332 return $this->snippets;
333 }
334
335 /**
336 * Add subscriber
337 *
338 * @param User $subscriber
339 *
340 * @return User
341 */
342 public function addSubscriber(User $subscriber): User {
343 $this->subscribers[] = $subscriber;
344
345 return $this;
346 }
347
348 /**
349 * Remove subscriber
350 *
351 * @param User $subscriber
352 */
353 public function removeSubscriber(User $subscriber): bool {
354 return $this->subscribers->removeElement($subscriber);
355 }
356
357 /**
358 * Get subscribers
359 *
360 * @return ArrayCollection
361 */
362 public function getSubscribers(): ArrayCollection {
363 return $this->subscribers;
364 }
365
366 /**
367 * Add subscription
368 *
369 * @param User $subscription
370 *
371 * @return User
372 */
373 public function addSubscription(User $subscription): User {
374 $this->subscriptions[] = $subscription;
375
376 return $this;
377 }
378
379 /**
380 * Remove subscription
381 *
382 * @param User $subscription
383 */
384 public function removeSubscription(User $subscription): bool {
385 return $this->subscriptions->removeElement($subscription);
386 }
387
388 /**
389 * Get subscriptions
390 *
391 * @return ArrayCollection
392 */
393 public function getSubscriptions(): ArrayCollection {
394 return $this->subscriptions;
395 }
396 }