return $this->
createContactFormValidation('contact_form.create',
$context);
} public function update(SalesChannelContext
$context): DataValidationDefinition
{ return $this->
createContactFormValidation('contact_form.update',
$context);
} private function createContactFormValidation(string
$validationName, SalesChannelContext
$context): DataValidationDefinition
{ $definition =
new DataValidationDefinition($validationName);
$definition ->
add('salutationId',
new NotBlank(),
new EntityExists(['entity' => 'salutation', 'context' =>
$context->
getContext()])) ->
add('email',
new NotBlank(),
new Email()) ->
add('subject',
new NotBlank()) ->
add('comment',
new NotBlank()) ->
add('firstName',
new Regex(['pattern' => self::DOMAIN_NAME_REGEX, 'match' => false
])) ->
add('lastName',
new Regex(['pattern' => self::DOMAIN_NAME_REGEX, 'match' => false
]));
$required =
$this->systemConfigService->
get('core.basicInformation.firstNameFieldRequired',
$context->
getSalesChannel()->
getId());
if ($required) {