$criteria =
new Criteria();
$criteria->
addFilter(new EqualsFilter('registrationSalesChannels.id',
$context->
getSalesChannel()->
getId()));
$validation->
add('requestedGroupId',
new EntityExists([ 'entity' => 'customer_group',
'context' =>
$context->
getContext(),
'criteria' =>
$criteria,
]));
if (!
$isGuest) { $minLength =
$this->systemConfigService->
get('core.loginRegistration.passwordMinLength',
$context->
getSalesChannelId());
$validation->
add('password',
new NotBlank(),
new Length(['min' =>
$minLength]));
$options =
['context' =>
$context->
getContext(), 'salesChannelContext' =>
$context];
$validation->
add('email',
new CustomerEmailUnique($options));
} $validationEvent =
new BuildValidationEvent($validation,
$data,
$context->
getContext());
$this->eventDispatcher->
dispatch($validationEvent,
$validationEvent->
getName());
return $validation;
} /**
* @return array<string, mixed>
*/