We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php#L64
// Validate the form in group "Default" $violations = $this->validator->validate($form);
Is it correct? Because in this example the Custom group never will be validated.
Custom
/** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add('foo', 'hidden', [ 'constraints' => [ new NotBlank(), ], 'validation_groups' => [ Constraint::DEFAULT_GROUP, ], ]); $builder->add('bar', 'hidden' , [ 'constraints' => [ new NotBlank(), ], 'validation_groups' => [ 'Custom', ], ]); } /** * @param OptionsResolverInterface $resolver */ public function setDefaultOptions(OptionsResolverInterface $resolver) { $resolver->setDefaults([ 'validation_groups' => [ Constraint::DEFAULT_GROUP, 'Custom', ], ]); }
The text was updated successfully, but these errors were encountered:
Yes, it is correct. Validation groups for Form's Data are retrieved into the https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php with FormValidator::getValidationGroups
FormValidator::getValidationGroups
Look also here https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Resources/config/validation.xml
Sorry, something went wrong.
Closing it because this doesn't look like a bug. As @origaminal said, validation groups are indeed taken into account to validate the forms.
No branches or pull requests
https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php#L64
Is it correct? Because in this example the
Custom
group never will be validated.The text was updated successfully, but these errors were encountered: