|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects\Geo; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping\ClassMetadata; |
|
6
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Interfaces\Objects\Geo\AddressEmbeddableInterface; |
|
7
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\Entity\Embeddable\Objects\AbstractEmbeddableObject; |
|
8
|
|
|
use EdmondsCommerce\DoctrineStaticMeta\MappingHelper; |
|
9
|
|
|
|
|
10
|
|
|
class AddressEmbeddable extends AbstractEmbeddableObject implements AddressEmbeddableInterface |
|
11
|
|
|
{ |
|
12
|
|
|
/** |
|
13
|
|
|
* @var string |
|
14
|
|
|
*/ |
|
15
|
|
|
private $houseNumber; |
|
16
|
|
|
/** |
|
17
|
|
|
* @var string |
|
18
|
|
|
*/ |
|
19
|
|
|
private $houseName; |
|
20
|
|
|
/** |
|
21
|
|
|
* @var string |
|
22
|
|
|
*/ |
|
23
|
|
|
private $street; |
|
24
|
|
|
/** |
|
25
|
|
|
* @var string |
|
26
|
|
|
*/ |
|
27
|
|
|
private $city; |
|
28
|
|
|
/** |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
private $countryCode; |
|
32
|
|
|
/** |
|
33
|
|
|
* @var string |
|
34
|
|
|
*/ |
|
35
|
|
|
private $postalCode; |
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
*/ |
|
39
|
|
|
private $postalArea; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @return string |
|
43
|
|
|
*/ |
|
44
|
1 |
|
public function getHouseNumber(): string |
|
45
|
|
|
{ |
|
46
|
1 |
|
return $this->houseNumber; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* @param string $houseNumber |
|
51
|
|
|
* |
|
52
|
|
|
* @return AddressEmbeddable |
|
53
|
|
|
*/ |
|
54
|
2 |
|
public function setHouseNumber(string $houseNumber): AddressEmbeddableInterface |
|
55
|
|
|
{ |
|
56
|
2 |
|
$this->houseNumber = $houseNumber; |
|
57
|
|
|
|
|
58
|
2 |
|
return $this; |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @return string |
|
63
|
|
|
*/ |
|
64
|
1 |
|
public function getHouseName(): string |
|
65
|
|
|
{ |
|
66
|
1 |
|
return $this->houseName; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @param string $houseName |
|
71
|
|
|
* |
|
72
|
|
|
* @return AddressEmbeddable |
|
73
|
|
|
*/ |
|
74
|
2 |
|
public function setHouseName(string $houseName): AddressEmbeddableInterface |
|
75
|
|
|
{ |
|
76
|
2 |
|
$this->houseName = $houseName; |
|
77
|
|
|
|
|
78
|
2 |
|
return $this; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @return string |
|
83
|
|
|
*/ |
|
84
|
1 |
|
public function getStreet(): string |
|
85
|
|
|
{ |
|
86
|
1 |
|
return $this->street; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @param string $street |
|
91
|
|
|
* |
|
92
|
|
|
* @return AddressEmbeddable |
|
93
|
|
|
*/ |
|
94
|
2 |
|
public function setStreet(string $street): AddressEmbeddableInterface |
|
95
|
|
|
{ |
|
96
|
2 |
|
$this->street = $street; |
|
97
|
|
|
|
|
98
|
2 |
|
return $this; |
|
99
|
|
|
} |
|
100
|
|
|
|
|
101
|
|
|
/** |
|
102
|
|
|
* @return string |
|
103
|
|
|
*/ |
|
104
|
1 |
|
public function getCity(): string |
|
105
|
|
|
{ |
|
106
|
1 |
|
return $this->city; |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
/** |
|
110
|
|
|
* @param string $city |
|
111
|
|
|
* |
|
112
|
|
|
* @return AddressEmbeddable |
|
113
|
|
|
*/ |
|
114
|
2 |
|
public function setCity(string $city): AddressEmbeddableInterface |
|
115
|
|
|
{ |
|
116
|
2 |
|
$this->city = $city; |
|
117
|
|
|
|
|
118
|
2 |
|
return $this; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @return string |
|
123
|
|
|
*/ |
|
124
|
1 |
|
public function getCountryCode(): string |
|
125
|
|
|
{ |
|
126
|
1 |
|
return $this->countryCode; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* @param string $countryCode |
|
131
|
|
|
* |
|
132
|
|
|
* @return AddressEmbeddable |
|
133
|
|
|
*/ |
|
134
|
2 |
|
public function setCountryCode(string $countryCode): AddressEmbeddableInterface |
|
135
|
|
|
{ |
|
136
|
2 |
|
$this->countryCode = $countryCode; |
|
137
|
|
|
|
|
138
|
2 |
|
return $this; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* @return string |
|
143
|
|
|
*/ |
|
144
|
1 |
|
public function getPostalCode(): string |
|
145
|
|
|
{ |
|
146
|
1 |
|
return $this->postalCode; |
|
147
|
|
|
} |
|
148
|
|
|
|
|
149
|
|
|
/** |
|
150
|
|
|
* @param string $postalCode |
|
151
|
|
|
* |
|
152
|
|
|
* @return AddressEmbeddable |
|
153
|
|
|
*/ |
|
154
|
2 |
|
public function setPostalCode(string $postalCode): AddressEmbeddableInterface |
|
155
|
|
|
{ |
|
156
|
2 |
|
$this->postalCode = $postalCode; |
|
157
|
|
|
|
|
158
|
2 |
|
return $this; |
|
159
|
|
|
} |
|
160
|
|
|
|
|
161
|
|
|
/** |
|
162
|
|
|
* @return string |
|
163
|
|
|
*/ |
|
164
|
1 |
|
public function getPostalArea(): string |
|
165
|
|
|
{ |
|
166
|
1 |
|
return $this->postalArea; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* @param string $postalArea |
|
171
|
|
|
* |
|
172
|
|
|
* @return AddressEmbeddable |
|
173
|
|
|
*/ |
|
174
|
2 |
|
public function setPostalArea(string $postalArea): AddressEmbeddableInterface |
|
175
|
|
|
{ |
|
176
|
2 |
|
$this->postalArea = $postalArea; |
|
177
|
|
|
|
|
178
|
2 |
|
return $this; |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @param ClassMetadata $metadata |
|
183
|
|
|
* @SuppressWarnings(PHPMD.StaticAccess) |
|
184
|
|
|
*/ |
|
185
|
1 |
|
public static function loadMetadata(ClassMetadata $metadata): void |
|
186
|
|
|
{ |
|
187
|
1 |
|
$builder = self::setEmbeddableAndGetBuilder($metadata); |
|
188
|
1 |
|
MappingHelper::setSimpleStringFields( |
|
189
|
|
|
[ |
|
190
|
1 |
|
AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NUMBER, |
|
191
|
|
|
AddressEmbeddableInterface::EMBEDDED_PROP_HOUSE_NAME, |
|
192
|
|
|
AddressEmbeddableInterface::EMBEDDED_PROP_STREET, |
|
193
|
|
|
AddressEmbeddableInterface::EMBEDDED_PROP_CITY, |
|
194
|
|
|
AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_CODE, |
|
195
|
|
|
AddressEmbeddableInterface::EMBEDDED_PROP_POSTAL_AREA, |
|
196
|
|
|
AddressEmbeddableInterface::EMBEDDED_PROP_COUNTRY_CODE, |
|
197
|
|
|
], |
|
198
|
1 |
|
$builder |
|
199
|
|
|
); |
|
200
|
1 |
|
} |
|
201
|
|
|
} |
|
202
|
|
|
|