-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator][GroupSequences] GroupSequences execute next group if first fail #22373
New issue
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
Comments
Looking through the code When mapping the constraints on the Form, $context->getViolations() is always a empty array, even when there's a violation. And mapping the constraints on the Entity it come with one position when there's a violation. |
It would be nice if one of you could upload an example project that one could just checkout and execute to try to reproduce your issue. |
Sure, https://github.com/gustavodpont/issue22373 On this example there's 2 constraints for property name, Length (min => 10, groups => Basic) and one Email (groups => Strict) and then the validation group is a GroupSequence (["Basic", "Strict"]), mapped on the Form. |
@gustavodpont thanks! :) |
same with Symfony 3.3.2. |
@gustavodpont Thanks a lot for this reproducer! I think I found a way to fix this. Could you please give #23722 a look? |
…Dude) This PR was merged into the 2.7 branch. Discussion ---------- [Form] Fixed GroupSequence with "constraints" option | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #22373 | License | MIT | Doc PR | ~ Commits ------- e39e7a4 [Form] Fixed GroupSequence with "constraints" option
This issue appears when form is used without entity/data_class. Both groups "Basic' and 'Strict' are validated even if there are violations in 'Basic'.
I also get the error:
The Symfony\Component\Validator\Constraints\GroupSequence::getIterator method is deprecated since version 2.5 and will be removed in 3.0. in Symfony\Component\Validator\Constraints\GroupSequence.php on line 107
which is caused in by Symfony\Component\Form\Extension\Validator\Constraints\FormValidator.php:(84)The
Form
andValidator
components are working standalone outside of symfony distribution, with all the dependencies also available.Here is how the form is configured:
The text was updated successfully, but these errors were encountered: