Completed
Push — master ( 096baa...85634b )
by Louis
26s queued 13s
created

User::getClubs()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace KI\UserBundle\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use JMS\Serializer\Annotation as JMS;
7
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * La classe User est divisée en deux (autre partie dans CoreUser)
12
 * Ici sont stockées les infos secondaires (infos de contact) dont on n'a pas
13
 * besoin 100% du temps.
14
 * @ORM\Entity(repositoryClass="KI\UserBundle\Repository\UserRepository")
15
 * @ORM\Table(name="fos_user")
16
 * @JMS\ExclusionPolicy("all")
17
 * @UniqueEntity("email")
18
 * @UniqueEntity("username")
19
 */
20
class User extends CoreUser
21
{
22
    /**
23
     * Genre [M|Mme]
24
     * @ORM\Column(name="gender", type="string", nullable=true)
25
     * @JMS\Expose
26
     * @Assert\Type("string")
27
     */
28
    protected $gender;
29
30
    /**
31
     * Promo (format: '0*', ie 016, 017...)
32
     * @ORM\Column(name="promo", type="string", nullable=true)
33
     * @JMS\Expose
34
     * @Assert\Type("string")
35
     * @Assert\Length(min=2,max=3)
36
     */
37
    protected $promo;
38
39
    /**
40
     * Département [1A|GCC|GCC-Archi|GMM|GI|IMI|VET|SEGF]
41
     * @ORM\Column(name="department", type="string", nullable=true)
42
     * @JMS\Expose
43
     * @Assert\Type("string")
44
     */
45
    protected $department;
46
47
    /**
48
     * Origine [CC|DD]
49
     * @ORM\Column(name="origin", type="string", nullable=true)
50
     * @JMS\Expose
51
     * @Assert\Type("string")
52
     */
53
    protected $origin;
54
55
    /**
56
     * Nationalité
57
     * @ORM\Column(name="nationality", type="string", nullable=true)
58
     * @JMS\Expose
59
     * @Assert\Type("string")
60
     */
61
    protected $nationality;
62
63
    /**
64
     * Chambre (M016, A53, 3èmeG), lieu de résidence
65
     * @ORM\Column(name="location", type="string", nullable=true)
66
     * @JMS\Expose
67
     * @Assert\Type("string")
68
     */
69
    protected $location;
70
71
    /**
72
     * Téléphone au format 06.12.34.56.78
73
     * @ORM\Column(name="phone", type="string", nullable=true)
74
     * @JMS\Expose
75
     * @Assert\Type("string")
76
     */
77
    protected $phone;
78
79
    /**
80
     * Pseudo Skype
81
     * @ORM\Column(name="skype", type="string", nullable=true)
82
     * @JMS\Expose
83
     * @Assert\Type("string")
84
     */
85
    protected $skype;
86
87
    /**
88
     * Cotisant BDE
89
     * @ORM\Column(name="allowedBde", type="boolean", nullable=true)
90
     * @JMS\Expose
91
     * @Assert\Type("boolean")
92
     */
93
    protected $allowedBde;
94
95
    /**
96
     * Cotisant BDS
97
     * @ORM\Column(name="allowedBds", type="boolean", nullable=true)
98
     * @JMS\Expose
99
     * @Assert\Type("boolean")
100
     */
101
    protected $allowedBds;
102
103
    /**
104
     * A fait le tutoriel d'intro ?
105
     * @ORM\Column(name="tour", type="boolean", nullable=true)
106
     * @JMS\Expose
107
     * @Assert\Type("boolean")
108
     */
109
    protected $tour;
110
111
    /**
112
     * Autorisation de rendre publiques les stats Foyer
113
     * @ORM\Column(name="statsFoyer", type="boolean")
114
     * @JMS\Expose
115
     * @Assert\Type("boolean")
116
     */
117
    protected $statsFoyer = true;
118
119
    /**
120
     * Autorisation de rendre publiques les stats PontHub
121
     * @ORM\Column(name="statsPonthub", type="boolean")
122
     * @JMS\Expose
123
     * @Assert\Type("boolean")
124
     */
125
    protected $statsPonthub = true;
126
127
    /**
128
     * Autorisation de rendre publiques les stats de la réponse D
129
     * @ORM\Column(name="statsFacegame", type="boolean")
130
     * @JMS\Expose
131
     * @Assert\Type("boolean")
132
     */
133
    protected $statsFacegame = true;
134
135
    /**
136
     * Solde Foyer
137
     * @ORM\Column(name="balance", type="float", nullable=true)
138
     * @JMS\Expose
139
     * @Assert\Type("float")
140
     */
141
    protected $balance = 0.0;
142
143
    /**
144
     * Activation des mails d'événements
145
     * @ORM\Column(name="mailEvent", type="boolean")
146
     * @JMS\Expose
147
     * @Assert\Type("boolean")
148
     */
149
    protected $mailEvent = true;
150
151
    /**
152
     * Activation des mails de modification d'événements
153
     * @ORM\Column(name="mailModification", type="boolean")
154
     * @JMS\Expose
155
     * @Assert\Type("boolean")
156
     */
157
    protected $mailModification = true;
158
159
    /**
160
     * Activation des mails de rappel de shotguns
161
     * @ORM\Column(name="mailShotgun", type="boolean")
162
     * @JMS\Expose
163
     * @Assert\Type("boolean")
164
     */
165
    protected $mailShotgun = true;
166
167
    /**
168
     * Achievements de l'utilisateur
169
     * @ORM\OneToMany(targetEntity="KI\UserBundle\Entity\AchievementUser", mappedBy="user", orphanRemoval=true)
170
     * @Assert\Valid()
171
     */
172
    protected $achievements;
173
174
    /**
175
     * Clubs de l'utilisateur
176
     * @ORM\OneToMany(targetEntity="KI\UserBundle\Entity\ClubUser", mappedBy="user", orphanRemoval=true)
177
     * @Assert\Valid()
178
     */
179
    protected $clubs;
180
181
    /**
182
     * Téléchargements de l'utilisateur
183
     * @ORM\OneToMany(targetEntity="KI\PonthubBundle\Entity\PonthubFileUser", mappedBy="user", orphanRemoval=true)
184
     * @Assert\Valid()
185
     */
186
    protected $downloads;
187
188
    /**
189
     * Transactions de l'utilisateur
190
     * @ORM\OneToMany(targetEntity="KI\FoyerBundle\Entity\Transaction", mappedBy="user")
191
     * @Assert\Valid()
192
     */
193
    protected $transactions;
194
195
    /**
196
     * Constructor
197
     */
198
    public function __construct()
199
    {
200
        parent::__construct();
201
202
        $this->achievements = new \Doctrine\Common\Collections\ArrayCollection();
203
        $this->clubs = new \Doctrine\Common\Collections\ArrayCollection();
204
        $this->downloads = new \Doctrine\Common\Collections\ArrayCollection();
205
        $this->transactions = new \Doctrine\Common\Collections\ArrayCollection();
206
    }
207
208
    protected function acronyme()
209
    {
210
        $r = '';
211
        foreach (explode(' ', $this->firstName.' '.$this->lastName) as $v) {
212
                    $r .= $v[0];
213
        }
214
        return $r.'\''.$this->promo;
215
    }
216
217
    /**
218
     * Set gender
219
     *
220
     * @param string $gender
221
     * @return User
222
     */
223
    public function setGender($gender)
224
    {
225
        $this->gender = $gender;
226
227
        return $this;
228
    }
229
230
    /**
231
     * Get gender
232
     *
233
     * @return string
234
     */
235
    public function getGender()
236
    {
237
        return $this->gender;
238
    }
239
240
    /**
241
     * Set promo
242
     *
243
     * @param string $promo
244
     * @return User
245
     */
246
    public function setPromo($promo)
247
    {
248
        $this->promo = $promo;
249
250
        return $this;
251
    }
252
253
    /**
254
     * Get promo
255
     *
256
     * @return string
257
     */
258
    public function getPromo()
259
    {
260
        return $this->promo;
261
    }
262
263
    /**
264
     * Set department
265
     *
266
     * @param string $department
267
     * @return User
268
     */
269
    public function setDepartment($department)
270
    {
271
        $this->department = $department;
272
273
        return $this;
274
    }
275
276
    /**
277
     * Get department
278
     *
279
     * @return string
280
     */
281
    public function getDepartment()
282
    {
283
        return $this->department;
284
    }
285
286
    /**
287
     * Set origin
288
     *
289
     * @param string $origin
290
     * @return User
291
     */
292
    public function setOrigin($origin)
293
    {
294
        $this->origin = $origin;
295
296
        return $this;
297
    }
298
299
    /**
300
     * Get origin
301
     *
302
     * @return string
303
     */
304
    public function getOrigin()
305
    {
306
        return $this->origin;
307
    }
308
309
    /**
310
     * Set nationality
311
     *
312
     * @param string $nationality
313
     * @return User
314
     */
315
    public function setNationality($nationality)
316
    {
317
        $this->nationality = $nationality;
318
319
        return $this;
320
    }
321
322
    /**
323
     * Get nationality
324
     *
325
     * @return string
326
     */
327
    public function getNationality()
328
    {
329
        return $this->nationality;
330
    }
331
332
    /**
333
     * Set location
334
     *
335
     * @param string $location
336
     * @return User
337
     */
338
    public function setLocation($location)
339
    {
340
        $this->location = $location;
341
342
        return $this;
343
    }
344
345
    /**
346
     * Get location
347
     *
348
     * @return string
349
     */
350
    public function getLocation()
351
    {
352
        return $this->location;
353
    }
354
355
    /**
356
     * Set phone
357
     *
358
     * @param string $phone
359
     * @return User
360
     */
361
    public function setPhone($phone)
362
    {
363
        $this->phone = $phone;
364
365
        return $this;
366
    }
367
368
    /**
369
     * Get phone
370
     *
371
     * @return string
372
     */
373
    public function getPhone()
374
    {
375
        return $this->phone;
376
    }
377
378
    /**
379
     * Set skype
380
     *
381
     * @param string $skype
382
     * @return User
383
     */
384
    public function setSkype($skype)
385
    {
386
        $this->skype = $skype;
387
388
        return $this;
389
    }
390
391
    /**
392
     * Get skype
393
     *
394
     * @return string
395
     */
396
    public function getSkype()
397
    {
398
        return $this->skype;
399
    }
400
401
    /**
402
     * Set allowedBde
403
     *
404
     * @param string $allowedBde
405
     * @return User
406
     */
407
    public function setAllowedBde($allowedBde)
408
    {
409
        $this->allowedBde = $allowedBde;
410
411
        return $this;
412
    }
413
414
    /**
415
     * Get allowedBde
416
     *
417
     * @return string
418
     */
419
    public function getAllowedBde()
420
    {
421
        return $this->allowedBde;
422
    }
423
424
    /**
425
     * Set allowedBds
426
     *
427
     * @param string $allowedBds
428
     * @return User
429
     */
430
    public function setAllowedBds($allowedBds)
431
    {
432
        $this->allowedBds = $allowedBds;
433
434
        return $this;
435
    }
436
437
    /**
438
     * Get allowedBds
439
     *
440
     * @return string
441
     */
442
    public function getAllowedBds()
443
    {
444
        return $this->allowedBds;
445
    }
446
447
    /**
448
     * Set tour
449
     *
450
     * @param string $tour
451
     * @return User
452
     */
453
    public function setTour($tour)
454
    {
455
        $this->tour = $tour;
456
457
        return $this;
458
    }
459
460
    /**
461
     * Get tour
462
     *
463
     * @return string
464
     */
465
    public function getTour()
466
    {
467
        return $this->tour;
468
    }
469
470
    /**
471
     * Set statsFoyer
472
     *
473
     * @param bool $statsFoyer
474
     * @return User
475
     */
476
    public function setStatsFoyer($statsFoyer)
477
    {
478
        $this->statsFoyer = $statsFoyer;
479
480
        return $this;
481
    }
482
483
    /**
484
     * Get statsFoyer
485
     *
486
     * @return string
487
     */
488
    public function getStatsFoyer()
489
    {
490
        return $this->statsFoyer;
491
    }
492
493
    /**
494
     * Set statsPonthub
495
     *
496
     * @param bool $statsPonthub
497
     * @return User
498
     */
499
    public function setStatsPonthub($statsPonthub)
500
    {
501
        $this->statsPonthub = $statsPonthub;
502
503
        return $this;
504
    }
505
506
    /**
507
     * Get statsPonthub
508
     *
509
     * @return string
510
     */
511
    public function getStatsPonthub()
512
    {
513
        return $this->statsPonthub;
514
    }
515
516
    /**
517
     * Set statsFacegame
518
     *
519
     * @param bool $statsFacegame
520
     * @return User
521
     */
522
    public function setStatsFacegame($statsFacegame)
523
    {
524
        $this->statsFacegame = $statsFacegame;
525
526
        return $this;
527
    }
528
529
    /**
530
     * Get statsFacegame
531
     *
532
     * @return string
533
     */
534
    public function getStatsFacegame()
535
    {
536
        return $this->statsFacegame;
537
    }
538
539
    /**
540
     * Set balance
541
     *
542
     * @param string $balance
543
     * @return User
544
     */
545
    public function setBalance($balance)
546
    {
547
        $this->balance = $balance;
548
        return $this;
549
    }
550
551
    /**
552
     * Get balance
553
     *
554
     * @return \Doctrine\Common\Collections\Collection
555
     */
556
    public function getBalance()
557
    {
558
        return $this->balance;
559
    }
560
561
    /**
562
     * Set mailEvent
563
     *
564
     * @param  boolean $mailEvent
565
     * @return User
566
     */
567
    public function setMailEvent($mailEvent)
568
    {
569
        $this->mailEvent = $mailEvent;
570
571
        return $this;
572
    }
573
574
    /**
575
     * Get mailEvent
576
     *
577
     * @return boolean
578
     */
579
    public function getMailEvent()
580
    {
581
        return $this->mailEvent;
582
    }
583
584
    /**
585
     * Set mailShotgun
586
     *
587
     * @param  boolean $mailShotgun
588
     * @return User
589
     */
590
    public function setMailShotgun($mailShotgun)
591
    {
592
        $this->mailShotgun = $mailShotgun;
593
594
        return $this;
595
    }
596
597
    /**
598
     * Get mailShotgun
599
     *
600
     * @return boolean
601
     */
602
    public function getMailShotgun()
603
    {
604
        return $this->mailShotgun;
605
    }
606
607
    /**
608
     * Set mailModification
609
     *
610
     * @param  boolean $mailModification
611
     * @return User
612
     */
613
    public function setMailModification($mailModification)
614
    {
615
        $this->mailModification = $mailModification;
616
617
        return $this;
618
    }
619
620
    /**
621
     * Get mailModification
622
     *
623
     * @return boolean
624
     */
625
    public function getMailModification()
626
    {
627
        return $this->mailModification;
628
    }
629
630
    /**
631
     * @return array
632
     */
633
    public function getClubs()
634
    {
635
        return $this->clubs;
636
    }
637
}
638