$criteria =
new Criteria(\
array_unique($addressIds));
$criteria->
setTitle('context-factory::addresses'
);
$criteria->
addAssociation('salutation'
);
$criteria->
addAssociation('country'
);
$criteria->
addAssociation('countryState'
);
$addresses =
$this->addressRepository->
search($criteria,
$context);
/** @var CustomerAddressEntity $activeBillingAddress */
$activeBillingAddress =
$addresses->
get($activeBillingAddressId);
$customer->
setActiveBillingAddress($activeBillingAddress);
/** @var CustomerAddressEntity $activeShippingAddress */
$activeShippingAddress =
$addresses->
get($activeShippingAddressId);
$customer->
setActiveShippingAddress($activeShippingAddress);
/** @var CustomerAddressEntity $defaultBillingAddress */
$defaultBillingAddress =
$addresses->
get($customer->
getDefaultBillingAddressId());
$customer->
setDefaultBillingAddress($defaultBillingAddress);
/** @var CustomerAddressEntity $defaultShippingAddress */
$defaultShippingAddress =
$addresses->
get($customer->
getDefaultShippingAddressId());
$customer->
setDefaultShippingAddress($defaultShippingAddress);
return $customer;
}