-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Form] Fixed ValidatorTypeGuesser to guess properties without constraints not to be required #12004
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
b521caf
to
2571828
Compare
Isn't it a BC break? |
@fabpot I don't think so. Before, when a field had no constraint, the "required" option was set to |
Got it now. 👍 |
2.3.20 | ||
------ | ||
|
||
* the validator guesser guesses fields for properties without any constraints |
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 removed as the changelogs for minor versions are auto-generated.
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.
removed
…ints not to be required
2571828
to
fd77b09
Compare
Thank you @webmozart. |
…out constraints not to be required (webmozart) This PR was merged into the 2.3 branch. Discussion ---------- [Form] Fixed ValidatorTypeGuesser to guess properties without constraints not to be required | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #6645 | License | MIT | Doc PR | - Consider the following entity: ```php class Author { /** * @Assert\NotBlank */ private $name; private $age; } ``` Right now, the "required" HTML attribute is set for both fields (since the default value of the "required" option is true). IMO this is wrong. With this fix, the ValidatorTypeGuesser guesses `false` for the "required" option unless a NotNull/NotBlank constraint is present. Commits ------- fd77b09 [Form] Fixed ValidatorTypeGuesser to guess properties without constraints not to be required
@webmozart wasn't this fixed already in #3821 |
Consider the following entity:
Right now, the "required" HTML attribute is set for both fields (since the default value of the "required" option is true). IMO this is wrong.
With this fix, the ValidatorTypeGuesser guesses
false
for the "required" option unless a NotNull/NotBlank constraint is present.