Skip to content

Unmapped forms are not validated #11268

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

Closed
stof opened this issue Jul 1, 2014 · 2 comments
Closed

Unmapped forms are not validated #11268

stof opened this issue Jul 1, 2014 · 2 comments

Comments

@stof
Copy link
Member

stof commented Jul 1, 2014

This is an issue being there since 2.1.

The FormValidator runs the validation of the underlying object graph in 2 cases:

  • on the root form
  • in case all parents have cascade_validation set to true

This means that when you have a subform with mapped set to false, the only way to have its object graph validation is to enable cascade_validation on all parents of the unmapped field, which will lead to duplicate validation of the object graph of the parent if it uses @Assert\Valid() properly.

As unmapped forms define a new object graph, I think it would make sense to run the validation on them as well.

/cc @webmozart

@webmozart
Copy link
Contributor

Fixed by #12237.

fabpot added a commit that referenced this issue 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"
@stof
Copy link
Member Author

stof commented Dec 15, 2015

@webmozart shouldn't unmapped forms run the walk data automatically, as they are separate root object graphs ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants