Skip to content

[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

Merged
merged 1 commit into from
Jun 17, 2015

Conversation

webmozart
Copy link
Contributor

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).

@webmozart webmozart force-pushed the deprecate-cascade-validation branch 2 times, most recently from 0f62d32 to 6ce406f Compare June 17, 2015 14:29
@webmozart
Copy link
Contributor Author

This has been rebased onto 2.8. Can you please review @symfony/deciders?

@@ -55,6 +55,45 @@ Form
...
{% endif %}
```

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@webmozart webmozart force-pushed the deprecate-cascade-validation branch from 6ce406f to b9cac9b Compare June 17, 2015 15:06
@@ -67,6 +67,14 @@ public function configureOptions(OptionsResolver $resolver)
return is_object($constraints) ? array($constraints) : (array) $constraints;
};

$cascadeValidationNormalizer = function (Options $options, $cascadeValidation) {
if ($cascadeValidation) {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@webmozart webmozart closed this Jun 17, 2015
@webmozart webmozart force-pushed the deprecate-cascade-validation branch from b9cac9b to 09fabfe Compare June 17, 2015 15:38
@webmozart webmozart reopened this Jun 17, 2015
@webmozart webmozart force-pushed the deprecate-cascade-validation branch from e19ec27 to 6c554c6 Compare June 17, 2015 18:03
@webmozart
Copy link
Contributor Author

Ready to be merged. Ping @symfony/deciders

@Tobion
Copy link
Contributor

Tobion commented Jun 17, 2015

👍

@fabpot
Copy link
Member

fabpot commented Jun 17, 2015

Thank you @webmozart.

@fabpot fabpot merged commit 6c554c6 into symfony:2.8 Jun 17, 2015
fabpot added a commit that referenced this pull request Jun 17, 2015
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"
weaverryan added a commit to symfony/symfony-docs that referenced this pull request Jun 19, 2015
…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
@fabpot fabpot mentioned this pull request Nov 16, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants