Closed
Description
Talk is cheap, show me the code:
class MyFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('foo', 'text', [
'constraints' => new Constraints\Length(['min' => 6]),
'validation_groups' => 'Bar',
]);
}
}
I expected this code to be equivalent to:
class MyFormType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('foo', 'text', [
'constraints' => new Constraints\Length(['min' => 6, 'groups' => 'Bar']),
]);
}
}
But it is not, validation groups are not respected in the first case.
If it cannot be fixed before 3.0, then it can at least throw an error like:
You cannot define validation groups to a form field, consider passing it as an option to your constraints.