-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] removed validation of form children #797
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
@bschussek: Can you review this patch? We're currently forcing the equivalent of an |
Validation of form children is necessary in case forms are working on decoupled objects. If form a has object X as data and child form a.b has object Y as data, and there is no connection between X and Y, Y won't be validated after your patch. What's the idea behind this PR? We should solve it in a different way. |
The problem is that child objects are validated and there is not way to disable that behavior. The validation component includes a |
I had a problem with this constraint aswell, if you define an embeded form where the object should be validated only if some other field is true/false this current feature makes it impossible to do so. |
We at least need a way to control whether validation cascades into each form child. Would this mean checking a new constraint that checks child forms based on a certain attribute or property on the parent? |
We have a related problem here: #1151 |
Whats going to happen with this issue? |
up, what is the status here @bschussek @kriswallsmith ? |
The commit proposed by Kris (797#commits-pushed-99fa9e0) solved the problem I described here: In my case, there were no explicit child forms. |
@kriswallsmith: This is now fixed in the referenced pull request. |
Commits ------- 0c70a41 [Form] Made validation of form children configurable. Set the option "cascade_validation" to `true` if you need it. Discussion ---------- [Form] Made validation of form children configurable Bug fix: yes Feature addition: yes Backwards compatibility break: yes Symfony2 tests pass: yes Fixes the following tickets: #797 Todo: adapt documentation  Child forms now aren't validated anymore by default. This is not a problem as long as @Valid constraints are properly put in your model. If you want to enable cascading validation, for example when there is no connection between the parent and the child model, you can set the option "cascade_validation" in the parent form to true. This change is not backwards compatible, but from my estimation the break should not affect many applications. --------------------------------------------------------------------------- by kriswallsmith at 2012-01-16T19:59:25Z :+1:
Validation of form children is not necessary. You can use the
Valid
constraint to accomplish this when desired.