-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] validate subforms in all validation groups #36865
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
Conversation
xabbuh
commented
May 19, 2020
Q | A |
---|---|
Branch? | 3.4 |
Bug fix? | yes |
New feature? | no |
Deprecations? | no |
Tickets | Fix #36852 |
License | MIT |
Doc PR |
@@ -86,7 +86,8 @@ public function validate($form, Constraint $formConstraint) | |||
// sequence recursively, thus some fields could fail | |||
// in different steps without breaking early enough | |||
$this->resolvedGroups[$field] = (array) $group; | |||
$validator->atPath(sprintf($fieldPropertyPath, $field->getPropertyPath()))->validate($field, $formConstraint); | |||
$fieldFormConstraint = new Form(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is needed for now to prevent hash collisions (see also #36415).
@@ -37,7 +38,7 @@ public function __construct(ValidatorInterface $validator) | |||
|
|||
/* @var $metadata ClassMetadata */ | |||
$metadata->addConstraint(new Form()); | |||
$metadata->addPropertyConstraint('children', new Valid()); | |||
$metadata->traversalStrategy = TraversalStrategy::NONE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
traversal happens explicitly inside the FormValidator
d17a4d2
to
2fa63a5
Compare
This is ready to be reviewed. |
68fcedb
to
27d9f82
Compare
/cc @HeahDude |
src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php
Outdated
Show resolved
Hide resolved
Thank you @xabbuh. |
This breaks property mapping in some way. |
Maybe the same as #37027? |