|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Application\Traits; |
|
6
|
|
|
|
|
7
|
|
|
use Application\Model\Country; |
|
8
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Common fields to represent an address. |
|
12
|
|
|
*/ |
|
13
|
|
|
trait HasAddress |
|
14
|
|
|
{ |
|
15
|
|
|
/** |
|
16
|
|
|
* @var string |
|
17
|
|
|
* @ORM\Column(type="string", length=191, options={"default" = ""}) |
|
18
|
|
|
*/ |
|
19
|
|
|
private $firstName = ''; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var string |
|
23
|
|
|
* @ORM\Column(type="string", length=191, options={"default" = ""}) |
|
24
|
|
|
*/ |
|
25
|
|
|
private $lastName = ''; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var string |
|
29
|
|
|
* @ORM\Column(type="string", options={"default" = ""}) |
|
30
|
|
|
*/ |
|
31
|
|
|
private $street = ''; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @var string |
|
35
|
|
|
* @ORM\Column(type="string", length=20, options={"default" = ""}) |
|
36
|
|
|
*/ |
|
37
|
|
|
private $postcode = ''; |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* @var string |
|
41
|
|
|
* @ORM\Column(type="string", length=255, options={"default" = ""}) |
|
42
|
|
|
*/ |
|
43
|
|
|
private $locality = ''; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var Country |
|
47
|
|
|
* @ORM\ManyToOne(targetEntity="Country") |
|
48
|
|
|
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") |
|
49
|
|
|
*/ |
|
50
|
|
|
private $country; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Set first name |
|
54
|
|
|
* |
|
55
|
|
|
* @param string $firstName |
|
56
|
|
|
*/ |
|
57
|
13 |
|
public function setFirstName($firstName): void |
|
58
|
|
|
{ |
|
59
|
13 |
|
$this->firstName = $firstName; |
|
60
|
13 |
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* Get first name |
|
64
|
|
|
*/ |
|
65
|
9 |
|
public function getFirstName(): string |
|
66
|
|
|
{ |
|
67
|
9 |
|
return (string) $this->firstName; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Set last name |
|
72
|
|
|
* |
|
73
|
|
|
* @param string $lastName |
|
74
|
|
|
*/ |
|
75
|
13 |
|
public function setLastName($lastName): void |
|
76
|
|
|
{ |
|
77
|
13 |
|
$this->lastName = $lastName; |
|
78
|
13 |
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Get last name |
|
82
|
|
|
*/ |
|
83
|
9 |
|
public function getLastName(): string |
|
84
|
|
|
{ |
|
85
|
9 |
|
return (string) $this->lastName; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
4 |
|
public function getStreet(): string |
|
89
|
|
|
{ |
|
90
|
4 |
|
return $this->street; |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
12 |
|
public function setStreet(string $street): void |
|
94
|
|
|
{ |
|
95
|
12 |
|
$this->street = $street; |
|
96
|
12 |
|
} |
|
97
|
|
|
|
|
98
|
4 |
|
public function getPostcode(): string |
|
99
|
|
|
{ |
|
100
|
4 |
|
return $this->postcode; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
12 |
|
public function setPostcode(string $postcode): void |
|
104
|
|
|
{ |
|
105
|
12 |
|
$this->postcode = $postcode; |
|
106
|
12 |
|
} |
|
107
|
|
|
|
|
108
|
4 |
|
public function getLocality(): string |
|
109
|
|
|
{ |
|
110
|
4 |
|
return $this->locality; |
|
111
|
|
|
} |
|
112
|
|
|
|
|
113
|
12 |
|
public function setLocality(string $locality): void |
|
114
|
|
|
{ |
|
115
|
12 |
|
$this->locality = $locality; |
|
116
|
12 |
|
} |
|
117
|
|
|
|
|
118
|
4 |
|
public function getCountry(): ?Country |
|
119
|
|
|
{ |
|
120
|
4 |
|
return $this->country; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
12 |
|
public function setCountry(?Country $country = null): void |
|
124
|
|
|
{ |
|
125
|
12 |
|
$this->country = $country; |
|
126
|
12 |
|
} |
|
127
|
|
|
} |
|
128
|
|
|
|