throw new DecorationPatternException(self::
class);
} #[Route(path: '/store-api/account/address', name: 'store-api.account.address.create', methods: ['POST'], defaults: ['addressId' => null, '_loginRequired' => true, '_loginRequiredAllowGuest' => true])]
#[Route(path: '/store-api/account/address/{addressId}', name: 'store-api.account.address.update', methods: ['PATCH'], defaults: ['_loginRequired' => true, '_loginRequiredAllowGuest' => true])]
public function upsert(?string
$addressId, RequestDataBag
$data, SalesChannelContext
$context, CustomerEntity
$customer): UpsertAddressRouteResponse
{ if (!
$addressId) { $isCreate = true;
$addressId = Uuid::
randomHex();
} else { $this->
validateAddress($addressId,
$context,
$customer);
$isCreate = false;
} if (!
$data->
get('salutationId'
)) { $data->
set('salutationId',
$this->
getDefaultSalutationId($context));
} $accountType =
$data->
get('accountType', CustomerEntity::ACCOUNT_TYPE_PRIVATE
);
$definition =
$this->
getValidationDefinition($data,
$accountType,
$isCreate,
$context);
$this->validator->
validate(array_merge(['id' =>
$addressId],
$data->
all()),
$definition);