I would like to validate a form using group validation and therefore I defined two validation groups. The second group should only be validated if the first group does not already cause violations. So I did this:
$form = $this->createFormBuilder(null,array('validation_groups' => new GroupSequence(array('group1','group2'))))
->add('email', EmailType::class,array('constraints' => array(
new Assert\Email(array('groups' => array('group1'))),
new Assert\NotBlank(array('groups' => array('group1'))),
new CustomAssert\AlreadyRegistered(array('groups' => array('group2'))))))
->add('submit',SubmitType::class,array())
->getForm();
But apparently none of the constraints are validated, the form is valid no matter what I enter in the email field.
What's wrong?