| @@ 203-223 (lines=21) @@ | ||
| 200 | * @param Address $address |
|
| 201 | * @param Language $language |
|
| 202 | */ |
|
| 203 | public function updateAddress( |
|
| 204 | Address $address, |
|
| 205 | Language $language |
|
| 206 | ) { |
|
| 207 | if ($this->isAddressChanged($address, $language)) { |
|
| 208 | if ($language->getCode() !== $this->mainLanguage->getCode()) { |
|
| 209 | $event = new AddressTranslated( |
|
| 210 | $this->actorId, |
|
| 211 | $address, |
|
| 212 | $language |
|
| 213 | ); |
|
| 214 | } else { |
|
| 215 | $event = new AddressUpdated( |
|
| 216 | $this->actorId, |
|
| 217 | $address |
|
| 218 | ); |
|
| 219 | } |
|
| 220 | ||
| 221 | $this->apply($event); |
|
| 222 | } |
|
| 223 | } |
|
| 224 | ||
| 225 | /** |
|
| 226 | * @param ContactPoint $contactPoint |
|
| @@ 173-184 (lines=12) @@ | ||
| 170 | $this->addresses[$this->mainLanguage->getCode()] = $majorInfoUpdated->getAddress(); |
|
| 171 | } |
|
| 172 | ||
| 173 | public function updateAddress(Address $address, Language $language): void |
|
| 174 | { |
|
| 175 | if ($language->getCode() === $this->mainLanguage->getCode()) { |
|
| 176 | $event = new AddressUpdated($this->placeId, $address); |
|
| 177 | } else { |
|
| 178 | $event = new AddressTranslated($this->placeId, $address, $language); |
|
| 179 | } |
|
| 180 | ||
| 181 | if ($this->allowAddressUpdate($address, $language)) { |
|
| 182 | $this->apply($event); |
|
| 183 | } |
|
| 184 | } |
|
| 185 | ||
| 186 | protected function applyAddressUpdated(AddressUpdated $addressUpdated): void |
|
| 187 | { |
|