$form =
$event->
getForm();
/** @var Address $data */
$data =
$form->
getData();
$customerType =
$form->
get('additional'
)->
get('customer_type'
)->
getData();
if ($customerType !== Customer::CUSTOMER_TYPE_BUSINESS || !
empty($data->
getCompany())) { return;
} $notBlank =
new NotBlank(['message' => null
]);
$error =
new FormError($notBlank->message
);
$error->
setOrigin($form->
get('company'
));
$form->
addError($error);
});
} private function addVatIdValidation(FormBuilderInterface
$builder) { $builder->
addEventListener(FormEvents::POST_SUBMIT,
function DFormEvent
$event) { $form =
$event->
getForm();
/** @var Address $data */