/** @var CustomerEntity $customer */
$customer =
$salesChannelContext->
getCustomer();
$criteria =
new Criteria([$customer->
getGroupId()]);
$criteria->
setLimit(1
);
$customerRequestedGroup =
$this->customerGroupRepository->
search($criteria,
$salesChannelContext->
getContext())->
first();
if ($customerRequestedGroup === null
) { throw CustomerException::
customerGroupNotFound($customer->
getGroupId());
} $this->eventDispatcher->
dispatch(new CustomerGroupRegistrationAccepted( $customer,
$customerRequestedGroup,
$salesChannelContext->
getContext() ));
} return new JsonResponse(null, JsonResponse::HTTP_NO_CONTENT
);
} /**
* @throws Exception
*/