/**
* @throws ValidationException
*/
public function validate(Address
$address) { $this->validationContext =
$this->validator->
startContext();
$additional =
$address->
getAdditional();
$customerType = !
empty($additional['customer_type'
]) ?
$additional['customer_type'
] : null;
if ($this->config->
get('shopSalutationRequired'
)) { $this->
validateField('salutation',
$address->
getSalutation(),
[new NotBlank()]);
} $this->
validateField('firstname',
$address->
getFirstname(),
[new NotBlank()]);
$this->
validateField('lastname',
$address->
getLastname(),
[new NotBlank()]);
$this->
validateField('street',
$address->
getStreet(),
[new NotBlank()]);
$this->
validateField('zipcode',
$address->
getZipcode(),
[new NotBlank()]);
$this->
validateField('city',
$address->
getCity(),
[new NotBlank()]);
$this->
validateField('country',
$address->
getCountry() ?
$address->
getCountry() : null,
[new NotBlank()]);
$this->
validateField('phone',
$address->
getPhone(),
$this->
getPhoneConstraints());
$this->
validateField('additionalAddressLine1',
$address->
getAdditionalAddressLine1(),
$this->
getAdditionalAddressline1Constraints());
$this->
validateField('additionalAddressLine2',
$address->
getAdditionalAddressLine2(),
$this->
getAdditionalAddressline2Constraints());