public function validate(FormEvent $event) { parent::validate($event); $form = $event->getForm(); if ($form->has('email')) { $email = $form->get('email')->getData(); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $form->get('email')->addError(new FormError("Invalid email address.")); } } }
public function buildForm(FormBuilderInterface $builder, array $options) { parent::buildForm($builder, $options); $builder->remove('first_name')->remove('middle_name')->remove('last_name')->remove('birth_date')->remove('phone_number')->remove('citizenship')->remove('marital_status')->remove('spouse')->remove('annual_income')->remove('estimated_income_tax')->remove('liquid_net_worth')->remove('employment_type'); }