Completed
Pull Request — master (#65)
by Jeroen De
04:58 queued 02:37
created

MembershipApplication::setLastName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace WMDE\Fundraising\Entities;
4
5
use Doctrine\ORM\Mapping as ORM;
6
use Gedmo\Mapping\Annotation as Gedmo;
7
8
/**
9
 * @since 2.0
10
 *
11
 * @ORM\Table(name="request", indexes={@ORM\Index(name="idx_donation_id", columns={"donation_id"})})
12
 * @ORM\Entity
13
 */
14
class MembershipApplication {
15
16
	/**
17
	 * @var integer|null
18
	 *
19
	 * @ORM\Column(name="donation_id", type="integer", nullable=true)
20
	 */
21
	private $donationId;
22
23
	/**
24
	 * @var \DateTime
25
	 *
26
	 * @Gedmo\Timestampable(on="create")
27
	 * @ORM\Column(name="timestamp", type="datetime")
28
	 */
29
	private $timestamp;
30
31
	/**
32
	 * @var string|null
33
	 *
34
	 * @ORM\Column(name="anrede", type="string", length=16, nullable=true)
35
	 */
36
	private $salutation;
37
38
	/**
39
	 * @var string|null
40
	 *
41
	 * @ORM\Column(name="firma", type="string", length=100, nullable=true)
42
	 */
43
	private $company;
44
45
	/**
46
	 * @var string|null
47
	 *
48
	 * @ORM\Column(name="titel", type="string", length=16, nullable=true)
49
	 */
50
	private $title;
51
52
	/**
53
	 * @var string
54
	 *
55
	 * @ORM\Column(name="name", type="string", length=250, options={"default":""}, nullable=false)
56
	 */
57
	private $name = '';
58
59
	/**
60
	 * @var string
61
	 *
62
	 * @ORM\Column(name="vorname", type="string", length=50, options={"default":""}, nullable=false)
63
	 */
64
	private $firstName = '';
65
66
	/**
67
	 * @var string
68
	 *
69
	 * @ORM\Column(name="nachname", type="string", length=50, options={"default":""}, nullable=false)
70
	 */
71
	private $lastName = '';
72
73
	/**
74
	 * @var string|null
75
	 *
76
	 * @ORM\Column(name="strasse", type="string", length=100, nullable=true)
77
	 */
78
	private $address;
79
80
	/**
81
	 * @var string|null
82
	 *
83
	 * @ORM\Column(name="plz", type="string", length=8, nullable=true)
84
	 */
85
	private $postcode;
86
87
	/**
88
	 * @var string|null
89
	 *
90
	 * @ORM\Column(name="ort", type="string", length=100, nullable=true)
91
	 */
92
	private $city;
93
94
	/**
95
	 * @var string
96
	 *
97
	 * @ORM\Column(name="email", type="string", length=250, options={"default":""}, nullable=false)
98
	 */
99
	private $email = '';
100
101
	/**
102
	 * @var string
103
	 *
104
	 * @ORM\Column(name="phone", type="string", length=30, options={"default":""}, nullable=false)
105
	 */
106
	private $phone = '';
107
108
	/**
109
	 * Date of birth
110
	 *
111
	 * @var \DateTime|null
112
	 *
113
	 * @ORM\Column(name="dob", type="date", nullable=true)
114
	 */
115
	private $dob;
116
117
	/**
118
	 * @var string
119
	 *
120
	 * @ORM\Column(name="wikimedium_shipping", type="string", options={"default":""}, nullable=false)
121
	 */
122
	private $wikimediumShipping = 'none';
123
124
	/**
125
	 * @var string
126
	 *
127
	 * @ORM\Column(name="membership_type", type="string", options={"default":"sustaining"}, nullable=false)
128
	 */
129
	private $membershipType = 'sustaining';
130
131
	/**
132
	 * @var integer
133
	 *
134
	 * @ORM\Column(name="membership_fee", type="integer", options={"default":0}, nullable=false)
135
	 */
136
	private $membershipFee = 0;
137
138
	/**
139
	 * @var integer
140
	 *
141
	 * @ORM\Column(name="membership_fee_interval", type="smallint", options={"default":12}, nullable=true)
142
	 */
143
	private $membershipFeeInterval = 12;
144
145
	/**
146
	 * @var string
147
	 *
148
	 * @ORM\Column(name="account_number", type="string", length=16, options={"default":""}, nullable=false)
149
	 */
150
	private $accountNumber = '';
151
152
	/**
153
	 * @var string
154
	 *
155
	 * @ORM\Column(name="bank_name", type="string", length=50, options={"default":""}, nullable=false)
156
	 */
157
	private $bankName = '';
158
159
	/**
160
	 * @var string
161
	 *
162
	 * @ORM\Column(name="bank_code", type="string", length=16, options={"default":""}, nullable=false)
163
	 */
164
	private $bankCode = '';
165
166
	/**
167
	 * @var string
168
	 *
169
	 * @ORM\Column(name="iban", type="string", length=32, options={"default":""}, nullable=true)
170
	 */
171
	private $iban = '';
172
173
	/**
174
	 * @var string
175
	 *
176
	 * @ORM\Column(name="bic", type="string", length=32, options={"default":""}, nullable=true)
177
	 */
178
	private $bic = '';
179
180
	/**
181
	 * @var string
182
	 *
183
	 * @ORM\Column(name="account_holder", type="string", length=50, options={"default":""}, nullable=false)
184
	 */
185
	private $accountHolder = '';
186
187
	/**
188
	 * @var string
189
	 *
190
	 * @ORM\Column(name="comment", type="text", options={"default":""}, nullable=false)
191
	 */
192
	private $comment = '';
193
194
	/**
195
	 * @var \DateTime
196
	 *
197
	 * @ORM\Column(name="export", type="datetime", nullable=true)
198
	 */
199
	private $export;
200
201
	/**
202
	 * @var \DateTime
203
	 *
204
	 * @ORM\Column(name="backup", type="datetime", nullable=true)
205
	 */
206
	private $backup;
207
208
	/**
209
	 * @var boolean
210
	 *
211
	 * @ORM\Column(name="wikilogin", type="boolean", options={"default":0}, nullable=false)
212
	 */
213
	private $wikilogin = 0;
214
215
	/**
216
	 * @var string
217
	 *
218
	 * @ORM\Column(name="tracking", type="string", length=50, nullable=true)
219
	 */
220
	private $tracking;
221
222
	/**
223
	 * @var integer
224
	 *
225
	 * @ORM\Column(name="status", type="smallint", options={"default":0}, nullable=true)
226
	 */
227
	private $status = 0;
228
229
	/**
230
	 * @var string
231
	 *
232
	 * @ORM\Column(name="country", type="string", length=8, options={"default":""}, nullable=true)
233
	 */
234
	private $country = '';
235
236
	/**
237
	 * @var string
238
	 *
239
	 * @ORM\Column(name="data", type="text", nullable=true)
240
	 */
241
	private $data;
242
243
	/**
244
	 * @var integer
245
	 *
246
	 * @ORM\Column(name="id", type="integer")
247
	 * @ORM\Id
248
	 * @ORM\GeneratedValue(strategy="IDENTITY")
249
	 */
250
	private $id;
251
252
	const STATUS_CONFIRMED = 1;
253
	const STATUS_NEUTRAL = 0;
254
	const STATUS_DELETED = -1;
255
	const STATUS_MODERATION = -2;
256
	const STATUS_ABORTED = -4;
257
	const STATUS_CANCELED = -8;
258
259
	/**
260
	 * @param integer|null $donationId
261
	 *
262
	 * @return self
263
	 */
264
	public function setDonationId( $donationId ) {
265
		$this->donationId = $donationId;
266
267
		return $this;
268
	}
269
270
	/**
271
	 * Returns the id of the donation that led to the membership application,
272
	 * or null when the application is not linked to any donation.
273
	 *
274
	 * @return integer|null
275
	 */
276
	public function getDonationId() {
277
		return $this->donationId;
278
	}
279
280
	/**
281
	 * @param \DateTime $timestamp
282
	 *
283
	 * @return self
284
	 */
285
	public function setTimestamp( $timestamp ) {
286
		$this->timestamp = $timestamp;
287
288
		return $this;
289
	}
290
291
	/**
292
	 * @return \DateTime
293
	 */
294
	public function getTimestamp() {
295
		return $this->timestamp;
296
	}
297
298
	/**
299
	 * @param string|null $salutation
300
	 *
301
	 * @return self
302
	 */
303
	public function setSalutation( $salutation ) {
304
		$this->salutation = $salutation;
305
306
		return $this;
307
	}
308
309
	/**
310
	 * @return string|null
311
	 */
312
	public function getSalutation() {
313
		return $this->salutation;
314
	}
315
316
	/**
317
	 * @param string|null $company
318
	 *
319
	 * @return self
320
	 */
321
	public function setCompany( $company ) {
322
		$this->company = $company;
323
324
		return $this;
325
	}
326
327
	/**
328
	 * @return string|null
329
	 */
330
	public function getCompany() {
331
		return $this->company;
332
	}
333
334
	/**
335
	 * @param string $title
336
	 *
337
	 * @return self
338
	 */
339
	public function setTitle( $title ) {
340
		$this->title = $title;
341
342
		return $this;
343
	}
344
345
	/**
346
	 * @return string
347
	 */
348
	public function getTitle() {
349
		return $this->title;
350
	}
351
352
	/**
353
	 * @param string $name
354
	 *
355
	 * @return self
356
	 */
357
	public function setName( $name ) {
358
		$this->name = $name;
359
360
		return $this;
361
	}
362
363
	/**
364
	 * @return string
365
	 */
366
	public function getName() {
367
		return $this->name;
368
	}
369
370
	/**
371
	 * @param string $firstName
372
	 *
373
	 * @return self
374
	 */
375
	public function setFirstName( $firstName ) {
376
		$this->firstName = $firstName;
377
		$this->setNameFromParts( $firstName, $this->getLastName() );
378
379
		return $this;
380
	}
381
382
	/**
383
	 * @return string
384
	 */
385
	public function getFirstName() {
386
		return $this->firstName;
387
	}
388
389
	/**
390
	 * @param string $lastName
391
	 *
392
	 * @return self
393
	 */
394
	public function setLastName( $lastName ) {
395
		$this->lastName = $lastName;
396
		$this->setNameFromParts( $this->getFirstName(), $lastName );
397
398
		return $this;
399
	}
400
401
	/**
402
	 * @return string
403
	 */
404
	public function getLastName() {
405
		return $this->lastName;
406
	}
407
408
	/**
409
	 * Sets the full name
410
	 */
411
	public function setNameFromParts( $vorname, $nachname) {
412
		$parts = array_filter( [ $vorname, $nachname ] );
413
		$this->setName( implode( ' ', $parts ) );
414
415
		return $this;
416
	}
417
418
	/**
419
	 * Set address (street, etc)
420
	 *
421
	 * @param string|null $address
422
	 *
423
	 * @return self
424
	 */
425
	public function setAddress( $address ) {
426
		$this->address = $address;
427
428
		return $this;
429
	}
430
431
	/**
432
	 * Get address (street, etc)
433
	 *
434
	 * @return string|null
435
	 */
436
	public function getAddress() {
437
		return $this->address;
438
	}
439
440
	/**
441
	 * @param string|null $postcode
442
	 *
443
	 * @return self
444
	 */
445
	public function setPostcode( $postcode ) {
446
		$this->postcode = $postcode;
447
448
		return $this;
449
	}
450
451
	/**
452
	 * @return string|null
453
	 */
454
	public function getPostcode() {
455
		return $this->postcode;
456
	}
457
458
	/**
459
	 * @param string|null $city
460
	 *
461
	 * @return self
462
	 */
463
	public function setCity( $city ) {
464
		$this->city = $city;
465
466
		return $this;
467
	}
468
469
	/**
470
	 * @return string|null
471
	 */
472
	public function getCity() {
473
		return $this->city;
474
	}
475
476
	/**
477
	 * Set email
478
	 *
479
	 * @param string $email
480
	 *
481
	 * @return self
482
	 */
483
	public function setEmail( $email ) {
484
		$this->email = $email;
485
486
		return $this;
487
	}
488
489
	/**
490
	 * Get email
491
	 *
492
	 * @return string
493
	 */
494
	public function getEmail() {
495
		return $this->email;
496
	}
497
498
	/**
499
	 * Set phone
500
	 *
501
	 * @param string $phone
502
	 *
503
	 * @return self
504
	 */
505
	public function setPhone( $phone ) {
506
		$this->phone = $phone;
507
508
		return $this;
509
	}
510
511
	/**
512
	 * Get phone
513
	 *
514
	 * @return string
515
	 */
516
	public function getPhone() {
517
		return $this->phone;
518
	}
519
520
	/**
521
	 * Sets the date of birth of the applicant
522
	 *
523
	 * @param \DateTime|null $dob
524
	 *
525
	 * @return self
526
	 */
527
	public function setDob( $dob ) {
528
		$this->dob = $dob;
529
530
		return $this;
531
	}
532
533
	/**
534
	 * Returns the date of birth of the applicant
535
	 *
536
	 * @return \DateTime|null
537
	 */
538
	public function getDob() {
539
		return $this->dob;
540
	}
541
542
	/**
543
	 * Set wikimediumShipping
544
	 *
545
	 * @param string $wikimediumShipping
546
	 *
547
	 * @return self
548
	 */
549
	public function setWikimediumShipping( $wikimediumShipping ) {
550
		$this->wikimediumShipping = $wikimediumShipping;
551
552
		return $this;
553
	}
554
555
	/**
556
	 * Get wikimediumShipping
557
	 *
558
	 * @return string
559
	 */
560
	public function getWikimediumShipping() {
561
		return $this->wikimediumShipping;
562
	}
563
564
	/**
565
	 * Set membershipType
566
	 *
567
	 * @param string $membershipType
568
	 *
569
	 	 * @return self
570
	 */
571
	public function setMembershipType( $membershipType ) {
572
		$this->membershipType = $membershipType;
573
574
		return $this;
575
	}
576
577
	/**
578
	 * Get membershipType
579
	 *
580
	 * @return string
581
	 */
582
	public function getMembershipType() {
583
		return $this->membershipType;
584
	}
585
586
	/**
587
	 * Set membershipFee
588
	 *
589
	 * @param integer $membershipFee
590
	 *
591
	 * @return self
592
	 */
593
	public function setMembershipFee( $membershipFee ) {
594
		$this->membershipFee = $membershipFee;
595
596
		return $this;
597
	}
598
599
	/**
600
	 * Get membershipFee
601
	 *
602
	 * @return integer
603
	 */
604
	public function getMembershipFee() {
605
		return $this->membershipFee;
606
	}
607
608
	/**
609
	 * Set membershipFeeInterval
610
	 *
611
	 * @param integer $membershipFeeInterval
612
	 *
613
	 * @return self
614
	 */
615
	public function setMembershipFeeInterval($membershipFeeInterval) {
616
		$this->membershipFeeInterval = $membershipFeeInterval;
617
618
		return $this;
619
	}
620
621
	/**
622
	 * Get membershipFeeInterval
623
	 *
624
	 * @return integer
625
	 */
626
	public function getMembershipFeeInterval() {
627
		return $this->membershipFeeInterval;
628
	}
629
630
631
	/**
632
	 * Set accountNumber
633
	 *
634
	 * @param string $accountNumber
635
	 *
636
	 * @return self
637
	 */
638
	public function setAccountNumber( $accountNumber ) {
639
		$this->accountNumber = $accountNumber;
640
641
		return $this;
642
	}
643
644
	/**
645
	 * Get accountNumber
646
	 *
647
	 * @return string
648
	 */
649
	public function getAccountNumber() {
650
		return $this->accountNumber;
651
	}
652
653
	/**
654
	 * Set bankName
655
	 *
656
	 * @param string $bankName
657
	 *
658
	 * @return self
659
	 */
660
	public function setBankName( $bankName ) {
661
		$this->bankName = $bankName;
662
663
		return $this;
664
	}
665
666
	/**
667
	 * Get bankName
668
	 *
669
	 * @return string
670
	 */
671
	public function getBankName() {
672
		return $this->bankName;
673
	}
674
675
	/**
676
	 * Set bankCode
677
	 *
678
	 * @param string $bankCode
679
	 *
680
	 * @return self
681
	 */
682
	public function setBankCode( $bankCode ) {
683
		$this->bankCode = $bankCode;
684
685
		return $this;
686
	}
687
688
	/**
689
	 * Get bankCode
690
	 *
691
	 * @return string
692
	 */
693
	public function getBankCode() {
694
		return $this->bankCode;
695
	}
696
697
	/**
698
	 * Set iban
699
	 *
700
	 * @param string $iban
701
	 *
702
	 * @return self
703
	 */
704
	public function setIban( $iban ) {
705
		$this->iban = $iban;
706
707
		return $this;
708
	}
709
710
	/**
711
	 * Get iban
712
	 *
713
	 * @return string
714
	 */
715
	public function getIban() {
716
		return $this->iban;
717
	}
718
719
	/**
720
	 * Set bic
721
	 *
722
	 * @param string $bic
723
	 *
724
	 * @return self
725
	 */
726
	public function setBic( $bic ) {
727
		$this->bic = $bic;
728
729
		return $this;
730
	}
731
732
	/**
733
	 * Get bic
734
	 *
735
	 * @return string
736
	 */
737
	public function getBic() {
738
		return $this->bic;
739
	}
740
741
	/**
742
	 * Set accountHolder
743
	 *
744
	 * @param string $accountHolder
745
	 *
746
	 * @return self
747
	 */
748
	public function setAccountHolder( $accountHolder ) {
749
		$this->accountHolder = $accountHolder;
750
751
		return $this;
752
	}
753
754
	/**
755
	 * Get accountHolder
756
	 *
757
	 * @return string
758
	 */
759
	public function getAccountHolder() {
760
		return $this->accountHolder;
761
	}
762
763
	/**
764
	 * Set comment
765
	 *
766
	 * @param string $comment
767
	 *
768
	 * @return self
769
	 */
770
	public function setComment( $comment ) {
771
		$this->comment = $comment;
772
773
		return $this;
774
	}
775
776
	/**
777
	 * Get comment
778
	 *
779
	 * @return string
780
	 */
781
	public function getComment() {
782
		return $this->comment;
783
	}
784
785
	/**
786
	 * Set export
787
	 *
788
	 * @param \DateTime $export
789
	 *
790
	 * @return self
791
	 */
792
	public function setExport( $export ) {
793
		$this->export = $export;
794
795
		return $this;
796
	}
797
798
	/**
799
	 * Get export
800
	 *
801
	 * @return \DateTime
802
	 */
803
	public function getExport() {
804
		return $this->export;
805
	}
806
807
	/**
808
	 * Set backup
809
	 *
810
	 * @param \DateTime $backup
811
	 *
812
	 * @return self
813
	 */
814
	public function setBackup( $backup ) {
815
		$this->backup = $backup;
816
817
		return $this;
818
	}
819
820
	/**
821
	 * Get backup
822
	 *
823
	 * @return \DateTime
824
	 */
825
	public function getBackup() {
826
		return $this->backup;
827
	}
828
829
	/**
830
	 * Set wikilogin
831
	 *
832
	 * @param boolean $wikilogin
833
	 *
834
	 * @return self
835
	 */
836
	public function setWikilogin( $wikilogin ) {
837
		$this->wikilogin = $wikilogin;
838
839
		return $this;
840
	}
841
842
	/**
843
	 * Get wikilogin
844
	 *
845
	 * @return boolean
846
	 */
847
	public function getWikilogin() {
848
		return $this->wikilogin;
849
	}
850
851
	/**
852
	 * Set tracking
853
	 *
854
	 * @param string $tracking
855
	 *
856
	 * @return self
857
	 */
858
	public function setTracking( $tracking ) {
859
		$this->tracking = $tracking;
860
861
		return $this;
862
	}
863
864
	/**
865
	 * Get tracking
866
	 *
867
	 * @return string
868
	 */
869
	public function getTracking() {
870
		return $this->tracking;
871
	}
872
873
	/**
874
	 * Set status
875
	 *
876
	 * @param integer $status
877
	 *
878
	 * @return self
879
	 */
880
	public function setStatus( $status ) {
881
		$this->status = $status;
882
883
		return $this;
884
	}
885
886
	/**
887
	 * Get status
888
	 *
889
	 * @return integer
890
	 */
891
	public function getStatus() {
892
		return $this->status;
893
	}
894
895
	/**
896
	 * Set country
897
	 *
898
	 * @param string $country
899
	 *
900
	 * @return self
901
	 */
902
	public function setCountry( $country ) {
903
		$this->country = $country;
904
905
		return $this;
906
	}
907
908
	/**
909
	 * Get country
910
	 *
911
	 * @return string
912
	 */
913
	public function getCountry() {
914
		return $this->country;
915
	}
916
917
	/**
918
	 * Set data
919
	 *
920
	 * @param string $data
921
	 * @return self
922
	 */
923
	public function setData( $data ) {
924
		$this->data = $data;
925
926
		return $this;
927
	}
928
929
	/**
930
	 * Get data
931
	 *
932
	 * @return string
933
	 */
934
	public function getData() {
935
		return $this->data;
936
	}
937
938
	/**
939
	 * Get id
940
	 *
941
	 * @return integer
942
	 */
943
	public function getId() {
944
		return $this->id;
945
	}
946
947
	public function isUnconfirmed() {
948
		return $this->getStatus() === self::STATUS_NEUTRAL;
949
	}
950
951
	public function log( $message ) {
952
		$dataArray = $this->getDataArray();
953
		$dataArray[ "log" ][ date( "Y-m-d H:i:s" ) ] = $message;
954
		return $this->saveDataArray( $dataArray );
955
	}
956
957
	private function getDataArray() {
958
		return unserialize( base64_decode( $this->data ) );
959
	}
960
961
	private function saveDataArray( array $dataArray ) {
962
		$this->data = base64_encode( serialize( $dataArray ) );
963
		return $this;
964
	}
965
}
966