Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.2k
[Forms] Fixed TextType empty_data value explanation#10743
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
The default value is ``''`` (the empty string). | ||
From an HTTP perspective, submitted data is always a string or an array of strings. | ||
So by default, the form will treat any empty string as null. If you prefer to get | ||
an empty string, explicitly set the ``empty_data`` option to an empty string. |
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.
@symfony/team-symfony-docs should we care about adding a note to say this possible since 3.2 only?
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.
Not needed because we merge in 3.4, so the minimum Symfony version already has that.
#SymfonyConHackday2018 |
Much better explained. Thanks a lot Valentin! |
…altsov)This PR was merged into the 3.4 branch.Discussion----------[Forms] Fixed TextType empty_data value explanation#SymfonyConHackDaySeesymfony/symfony#18357 that introduced a way to use an empty string in models, so setter does not have to be nullable. Usage example:https://github.com/EnMarche/en-marche.fr/blob/master/src/Form/TypeExtension/TextTypeExtension.php#L28Thanx to@HeahDude for helping me with this PR.Commits-------5cfff92 Fix TextType empty_data value explanation
Uh oh!
There was an error while loading.Please reload this page.
#SymfonyConHackDay
Seesymfony/symfony#18357 that introduced a way to use an empty string in models, so setter does not have to be nullable. Usage example:https://github.com/EnMarche/en-marche.fr/blob/master/src/Form/TypeExtension/TextTypeExtension.php#L28
Thanx to@HeahDude for helping me with this PR.