User::setPromo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
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
     * Notifications de l'utilisateur
197
     * @ORM\ManyToMany(targetEntity="KI\UserBundle\Entity\Notification", mappedBy="recipients")
198
     * @Assert\Valid()
199
     */
200
    protected $notifications;
201
202
    /**
203
     * Notifications lues de l'utilisateur
204
     * @ORM\ManyToMany(targetEntity="KI\UserBundle\Entity\Notification", mappedBy="reads")
205
     * @Assert\Valid()
206
     */
207
    protected $notificationsRead;
208
209
    /**
210
     * Constructor
211
     */
212
    public function __construct()
213
    {
214
        parent::__construct();
215
216
        $this->achievements = new \Doctrine\Common\Collections\ArrayCollection();
217
        $this->clubs = new \Doctrine\Common\Collections\ArrayCollection();
218
        $this->downloads = new \Doctrine\Common\Collections\ArrayCollection();
219
        $this->transactions = new \Doctrine\Common\Collections\ArrayCollection();
220
    }
221
222
    protected function acronyme()
223
    {
224
        $r = '';
225
        foreach (explode(' ', $this->firstName.' '.$this->lastName) as $v) {
226
                    $r .= $v[0];
227
        }
228
        return $r.'\''.$this->promo;
229
    }
230
231
    /**
232
     * Set gender
233
     *
234
     * @param string $gender
235
     * @return User
236
     */
237
    public function setGender($gender)
238
    {
239
        $this->gender = $gender;
240
241
        return $this;
242
    }
243
244
    /**
245
     * Get gender
246
     *
247
     * @return string
248
     */
249
    public function getGender()
250
    {
251
        return $this->gender;
252
    }
253
254
    /**
255
     * Set promo
256
     *
257
     * @param string $promo
258
     * @return User
259
     */
260
    public function setPromo($promo)
261
    {
262
        $this->promo = $promo;
263
264
        return $this;
265
    }
266
267
    /**
268
     * Get promo
269
     *
270
     * @return string
271
     */
272
    public function getPromo()
273
    {
274
        return $this->promo;
275
    }
276
277
    /**
278
     * Set department
279
     *
280
     * @param string $department
281
     * @return User
282
     */
283
    public function setDepartment($department)
284
    {
285
        $this->department = $department;
286
287
        return $this;
288
    }
289
290
    /**
291
     * Get department
292
     *
293
     * @return string
294
     */
295
    public function getDepartment()
296
    {
297
        return $this->department;
298
    }
299
300
    /**
301
     * Set origin
302
     *
303
     * @param string $origin
304
     * @return User
305
     */
306
    public function setOrigin($origin)
307
    {
308
        $this->origin = $origin;
309
310
        return $this;
311
    }
312
313
    /**
314
     * Get origin
315
     *
316
     * @return string
317
     */
318
    public function getOrigin()
319
    {
320
        return $this->origin;
321
    }
322
323
    /**
324
     * Set nationality
325
     *
326
     * @param string $nationality
327
     * @return User
328
     */
329
    public function setNationality($nationality)
330
    {
331
        $this->nationality = $nationality;
332
333
        return $this;
334
    }
335
336
    /**
337
     * Get nationality
338
     *
339
     * @return string
340
     */
341
    public function getNationality()
342
    {
343
        return $this->nationality;
344
    }
345
346
    /**
347
     * Set location
348
     *
349
     * @param string $location
350
     * @return User
351
     */
352
    public function setLocation($location)
353
    {
354
        $this->location = $location;
355
356
        return $this;
357
    }
358
359
    /**
360
     * Get location
361
     *
362
     * @return string
363
     */
364
    public function getLocation()
365
    {
366
        return $this->location;
367
    }
368
369
    /**
370
     * Set phone
371
     *
372
     * @param string $phone
373
     * @return User
374
     */
375
    public function setPhone($phone)
376
    {
377
        $this->phone = $phone;
378
379
        return $this;
380
    }
381
382
    /**
383
     * Get phone
384
     *
385
     * @return string
386
     */
387
    public function getPhone()
388
    {
389
        return $this->phone;
390
    }
391
392
    /**
393
     * Set skype
394
     *
395
     * @param string $skype
396
     * @return User
397
     */
398
    public function setSkype($skype)
399
    {
400
        $this->skype = $skype;
401
402
        return $this;
403
    }
404
405
    /**
406
     * Get skype
407
     *
408
     * @return string
409
     */
410
    public function getSkype()
411
    {
412
        return $this->skype;
413
    }
414
415
    /**
416
     * Set allowedBde
417
     *
418
     * @param string $allowedBde
419
     * @return User
420
     */
421
    public function setAllowedBde($allowedBde)
422
    {
423
        $this->allowedBde = $allowedBde;
424
425
        return $this;
426
    }
427
428
    /**
429
     * Get allowedBde
430
     *
431
     * @return string
432
     */
433
    public function getAllowedBde()
434
    {
435
        return $this->allowedBde;
436
    }
437
438
    /**
439
     * Set allowedBds
440
     *
441
     * @param string $allowedBds
442
     * @return User
443
     */
444
    public function setAllowedBds($allowedBds)
445
    {
446
        $this->allowedBds = $allowedBds;
447
448
        return $this;
449
    }
450
451
    /**
452
     * Get allowedBds
453
     *
454
     * @return string
455
     */
456
    public function getAllowedBds()
457
    {
458
        return $this->allowedBds;
459
    }
460
461
    /**
462
     * Set tour
463
     *
464
     * @param string $tour
465
     * @return User
466
     */
467
    public function setTour($tour)
468
    {
469
        $this->tour = $tour;
470
471
        return $this;
472
    }
473
474
    /**
475
     * Get tour
476
     *
477
     * @return string
478
     */
479
    public function getTour()
480
    {
481
        return $this->tour;
482
    }
483
484
    /**
485
     * Set statsFoyer
486
     *
487
     * @param bool $statsFoyer
488
     * @return User
489
     */
490
    public function setStatsFoyer($statsFoyer)
491
    {
492
        $this->statsFoyer = $statsFoyer;
493
494
        return $this;
495
    }
496
497
    /**
498
     * Get statsFoyer
499
     *
500
     * @return string
501
     */
502
    public function getStatsFoyer()
503
    {
504
        return $this->statsFoyer;
505
    }
506
507
    /**
508
     * Set statsPonthub
509
     *
510
     * @param bool $statsPonthub
511
     * @return User
512
     */
513
    public function setStatsPonthub($statsPonthub)
514
    {
515
        $this->statsPonthub = $statsPonthub;
516
517
        return $this;
518
    }
519
520
    /**
521
     * Get statsPonthub
522
     *
523
     * @return string
524
     */
525
    public function getStatsPonthub()
526
    {
527
        return $this->statsPonthub;
528
    }
529
530
    /**
531
     * Set statsFacegame
532
     *
533
     * @param bool $statsFacegame
534
     * @return User
535
     */
536
    public function setStatsFacegame($statsFacegame)
537
    {
538
        $this->statsFacegame = $statsFacegame;
539
540
        return $this;
541
    }
542
543
    /**
544
     * Get statsFacegame
545
     *
546
     * @return string
547
     */
548
    public function getStatsFacegame()
549
    {
550
        return $this->statsFacegame;
551
    }
552
553
    /**
554
     * Set balance
555
     *
556
     * @param string $balance
557
     * @return User
558
     */
559
    public function setBalance($balance)
560
    {
561
        $this->balance = $balance;
562
        return $this;
563
    }
564
565
    /**
566
     * Get balance
567
     *
568
     * @return \Doctrine\Common\Collections\Collection
569
     */
570
    public function getBalance()
571
    {
572
        return $this->balance;
573
    }
574
575
    /**
576
     * Set mailEvent
577
     *
578
     * @param  boolean $mailEvent
579
     * @return User
580
     */
581
    public function setMailEvent($mailEvent)
582
    {
583
        $this->mailEvent = $mailEvent;
584
585
        return $this;
586
    }
587
588
    /**
589
     * Get mailEvent
590
     *
591
     * @return boolean
592
     */
593
    public function getMailEvent()
594
    {
595
        return $this->mailEvent;
596
    }
597
598
    /**
599
     * Set mailShotgun
600
     *
601
     * @param  boolean $mailShotgun
602
     * @return User
603
     */
604
    public function setMailShotgun($mailShotgun)
605
    {
606
        $this->mailShotgun = $mailShotgun;
607
608
        return $this;
609
    }
610
611
    /**
612
     * Get mailShotgun
613
     *
614
     * @return boolean
615
     */
616
    public function getMailShotgun()
617
    {
618
        return $this->mailShotgun;
619
    }
620
621
    /**
622
     * Set mailModification
623
     *
624
     * @param  boolean $mailModification
625
     * @return User
626
     */
627
    public function setMailModification($mailModification)
628
    {
629
        $this->mailModification = $mailModification;
630
631
        return $this;
632
    }
633
634
    /**
635
     * Get mailModification
636
     *
637
     * @return boolean
638
     */
639
    public function getMailModification()
640
    {
641
        return $this->mailModification;
642
    }
643
644
    /**
645
     * @return array
646
     */
647
    public function getClubs()
648
    {
649
        return $this->clubs;
650
    }
651
}
652