Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] Deprecated "cascade_validation"#12237
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
craue commentedOct 16, 2014
Instead of removing that option I'd prefer it would be recursively passed properly to all children (as I expected from its name). That would make validation more failsafe when you don't need to remember adding the |
stof commentedOct 16, 2014
@craue cascade_validation was introduced s a way to reproduce the 2.0 behavior of the form validation. It is not intended to be the standard way of validating forms (which is why it is disabled by default). |
peterrehm commentedOct 16, 2014
Why don't we think about validation by default all child entites? I think this is what you usually need. I acutally got used to cascade_validation since it is the way how it has been documented. http://symfony.com/doc/current/book/forms.html#embedding-a-single-object When docs will be updated this should be covered as well. |
peterrehm commentedOct 16, 2014
In addition to that Assert\Valid() works differently compared to cascade_validation as discussed here: I think the way how cascade_validation works is actually what you would expect. There are cases where your child forms will have validation groups based on there state so you should not add this to the parent form. Or what do you recommend in regard to this? |
peterrehm commentedOct 19, 2014
I would say if this is changed the validation_groups of the child forms should be respected accordingly as with the cascade_validation setting. I would assume moving all people from cascade_validation to Assert\Valid() and not providing a solution for the validation_groups setting to have validation groups based on the entity state would lead to many issues. Or we add another logic and tie the logic to the entity as we started to discuss here#11880. |
webmozart commentedOct 20, 2014
@craue As I mentioned in the ticket description, there's almost no valid use case to use "cascade_validation". Use the Valid constraint, always. @peterrehm This is in fact a documentation issue. I opened a new ticket there:symfony/symfony-docs#4346
That's the correct approach to solve the problem IMO. |
peterrehm commentedOct 20, 2014
Is there anything else affected rather than the validation_groups setting of the form? |
webmozart commentedOct 21, 2014
I'm not sure that's a good idea, but it's an option. |
peterrehm commentedOct 21, 2014
But if not deprecated (I don't know as well if it is a good idea) I think we should consider cascading them as cascade_validation does. |
…ed forms to Valid... (peterrehm)This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes#4348).Discussion----------Updated information about handling validation of embedded forms to Valid...| Q | A| ------------- | ---| Doc fix? | yes| New docs? | no| Applies to | all| Fixed tickets |#4346Applied Valid constraint instead of the cascade_validation option since this option is supposed to be deprecated withsymfony/symfony#12237Commits-------b699731 Updated information about handling validation of embedded forms to Valid constraint
webmozart commentedNov 3, 2014
ping @symfony/deciders |
Tobion commentedNov 3, 2014
@webmozart what is that 1%? |
stof commentedNov 21, 2014
@webmozart this PR should probably be sent again with the 2.7 branch as target (and rebased) so that tests can run (Travis is currently not working on 3.0.x-dev even if you rebase). I would like to see#11268 fixed as it is a nasty bug. |
peterrehm commentedMar 20, 2015
Any progress on that one? |
webmozart commentedApr 24, 2015
@Tobion The use case when you have a subform with an object that is not referred to from the parent form's object (so |
…imler)This PR was merged into the 2.8 branch.Discussion----------fix Merge branch '2.7' into 2.8 JsonFileLoaderThis fix a merge commit seesymfony@5593bdd. The `stream_is_local` and `file_exists` checks are all ready done in the parent `FileLoader` class.| Q | A| ------------- | ---| Bug fix? | no| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | no| Fixed tickets | none| License | MIT| Doc PR | noneCommits-------692deff fix Merge branch '2.7' into 2.8 JsonFileLoader
This PR was merged into the 2.8 branch.Discussion----------[Profiler][Translation] added filter.| Q | A| ------------- | ---| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Fixed tickets | ~| Tests pass? | yes| License | MITCommits-------65f9291 [Profiler][Translation] added filter.
This PR was submitted for the master branch but it was merged into the 2.8 branch instead (closessymfony#12067).Discussion----------[Form] Added the 'range' FormType| Q | A| ------------- | ---| Bug fix? | no| New feature? | yes| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |symfony#11979| License | MIT| Doc PR |Implemented the "range" FormType.Commits-------b52e197 [Form] Added the 'range' FormType
a21072b tod85c817Comparewebmozart commentedJun 17, 2015
Replaced by#15019. |
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 | TODOThis 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 onsymfony/symfony#12237 and has been updated basedassymfony/symfony#15019.#4348Commits-------22a87b5 Added depreciation note for the cascade_validation constraint and updated position of depreciation notes
The "cascade_validation" option was designed for a 1% use case and comparatively used way too often when the
Validconstraint 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
Validconstraint instead. Alternatively, set the constraint in the model (as most people hopefully do).