public function swap(string
$addressId, string
$type, SalesChannelContext
$context, CustomerEntity
$customer): NoContentResponse
{ $this->
validateAddress($addressId,
$context,
$customer);
switch ($type) { case self::TYPE_BILLING:
$data =
[ 'id' =>
$customer->
getId(),
'defaultBillingAddressId' =>
$addressId,
];
$event =
new CustomerSetDefaultBillingAddressEvent($context,
$customer,
$addressId);
$this->eventDispatcher->
dispatch($event);
break;
default:
$data =
[ 'id' =>
$customer->
getId(),
'defaultShippingAddressId' =>
$addressId,
];
$event =
new CustomerSetDefaultShippingAddressEvent($context,
$customer,
$addressId);
$this->eventDispatcher->
dispatch($event);