$customer =
$this->
getCustomerByEmail((string) $request->request->
get('id'
),
$email,
$context,
$boundSalesChannelId);
if (!
$customer) { return new JsonResponse( ['isValid' => true
] );
} $message = 'The email address {{ email }} is already in use';
$params['{{ email }}'
] =
$email;
if ($customer->
getBoundSalesChannel()) { $message .= ' in the Sales Channel {{ salesChannel }}';
$params['{{ salesChannel }}'
] =
$customer->
getBoundSalesChannel()->
getName();
} $violations =
new ConstraintViolationList();
$violations->
add(new ConstraintViolation( str_replace(array_keys($params),
array_values($params),
$message),
$message,
$params,
null,
null,