-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Deprecated "cascade_validation" #15019
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
0f62d32
to
6ce406f
Compare
This has been rebased onto 2.8. Can you please review @symfony/deciders? |
@@ -55,6 +55,45 @@ Form | |||
... | |||
{% endif %} | |||
``` | |||
|
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.
should be move to the 2.8 UPGRADE file.
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.
Thanks!
6ce406f
to
b9cac9b
Compare
@@ -67,6 +67,14 @@ public function configureOptions(OptionsResolver $resolver) | |||
return is_object($constraints) ? array($constraints) : (array) $constraints; | |||
}; | |||
|
|||
$cascadeValidationNormalizer = function (Options $options, $cascadeValidation) { | |||
if ($cascadeValidation) { |
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 will trigger the deprecation only if people set the value to true. but for the people that set it to false, it should probably also trigger a deprecation. when we remove the option completely, even false
will break their code as it creates an unknown option error. So what we did with some options is to change the default to null
and then trigger the deorecation when !== null
. and return false
for null in the normalizer to keep the boolean logic.
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.
I was thinking about doing that. Let's do this.
b9cac9b
to
09fabfe
Compare
e19ec27
to
6c554c6
Compare
Ready to be merged. Ping @symfony/deciders |
👍 |
Thank you @webmozart. |
This PR was merged into the 2.8 branch. Discussion ---------- [Form] Deprecated "cascade_validation" | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #11268 (requires explicit work though) | License | MIT | Doc PR | TODO This is #12237 rebased on 2.8. The "cascade_validation" option was designed for a 1% use case and comparatively used way too often when the `Valid` constraint should have been used instead. Also, there seem to be bugs with that option (#5204). The option is now deprecated. When using the 2.5 Validator API, you can set the "constraints" option of the respective child to a `Valid` constraint instead. Alternatively, set the constraint in the model (as most people hopefully do). Commits ------- 6c554c6 [Form] Deprecated "cascade_validation"
…n constraint (peterrehm) This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closes #4354). Discussion ---------- [WCM] Added depreciation note for the cascade_validation constraint | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.8 | Fixed tickets | - This PR was based on symfony/symfony#12237 and has been updated based as symfony/symfony#15019. #4348 Commits ------- 22a87b5 Added depreciation note for the cascade_validation constraint and updated position of depreciation notes
This is #12237 rebased on 2.8.
The "cascade_validation" option was designed for a 1% use case and comparatively used way too often when the
Valid
constraint should have been used instead. Also, there seem to be bugs with that option (#5204).The option is now deprecated. When using the 2.5 Validator API, you can set the "constraints" option of the respective child to a
Valid
constraint instead. Alternatively, set the constraint in the model (as most people hopefully do).