if (!
$constraint instanceof FormEmail
) { return;
} /** @var FormInterface<Customer> $form */
$form =
$this->context->
getRoot();
$customer =
$form->
getData();
$accountMode =
$this->
getAccountMode($form);
$emailConstraint =
new CustomerEmail([ 'shop' =>
$constraint->
getShop(),
'customerId' =>
$customer->
getId(),
'accountMode' =>
$accountMode,
]);
$this->customerEmailValidator->
initialize($this->context
);
$this->customerEmailValidator->
validate($email,
$emailConstraint);
if ($form->
has('emailConfirmation'
) &&
$form->
get('emailConfirmation'
)->
getData() !==
$email) { $error =
new FormError($this->
getSnippet());
$error->
setOrigin($form->
get('emailConfirmation'
));