Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork5.3k
[WIP] [2.7+] explicit differences between 'data' & 'empty_data' options in FormType#6265
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 values for form fields are taken directly from the underlying | ||
| data structure(e.g. an entity or an array). The ``data`` option overrides | ||
| this default value. | ||
| data structurematching the field name with a property of an object or a |
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.
I tried to centralize structure references in the note.
| This option determines what value the field will return when the submitted | ||
| value is empty. | ||
| value is empty. It does not set an initial value if none is provided when | ||
| the form is rendered in a view (see ``data`` or ``placeholder`` options). |
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.
It would be nice to link the options
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.
Please can some one tell me how can I do it?
HeahDude commentedApr 25, 2016
Updated. closes#6340. |
HeahDude commentedMay 10, 2016
Any reviews here? There are many confusions about this. |
| data structure(e.g. an entity or an array). The ``data`` option overrides | ||
| this default value. | ||
| data structurematching the field's name with a property of an object or a | ||
| key of an array. The ``data`` option overridesthis default value. |
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.
You should make it clearer than overriding the default value like this will cause issues if you are using the form to edit an object rather than to create it, as the form value will still be filled fromdata even if the underlying data structure also has a value for it
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.
Thank you for this heads-up!
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.
@stof done in the sentence below
e3894be to133a77cCompareHeahDude commentedMay 21, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Ok there is quite some work here before it's finished. I propose to override the
with dedicated example. It would be easier with a second marker like it's currently done with What do you think? |
xabbuh commentedMay 21, 2016
@HeahDude sounds like a good plan to me |
HeahDude commentedJun 30, 2016
xabbuh commentedNov 10, 2016
@HeahDude Do you think you may find some time to finish this one? :) |
HeahDude commentedNov 19, 2016
It's hard to find some time these days, but sure I will :) In the meanwhile if someone wants to take over this PR, let it be! |
wouterj commentedApr 15, 2017
Closing in favor of#7802 |
…s more visisble (HeahDude, wouterj, javiereguiluz)This PR was merged into the 2.7 branch.Discussion----------[Form] Make difference between data and empty_data options more visisbleFinishes#6265Fixes#7299,#7596Commits-------64e3984 Fixed a minor typodf9b878 Fixed a minor typof375489 Better explain empty_data valuesd552ea3 Readd mixed type for empty_data, it can be string, array or object188f0ab Tried to write the important points more explicitly5f3813d Updated the example add added a caution4fd2d96 Addressed@stof's comment242941a improved accuracy67c93b6 fix typo87b3542 explicit differences between 'data' & 'empty_data' in FormType
It seems to be some confusion between two options
dataand empty_data` in regard of these two old symfony issues I read yesterday (symfony/symfony#14579,symfony/symfony#16530).Probably because of their name and the fact that they both are some kind of "placeholder" in different step of the form cycle.
@jakzal advise me to open a PR here for that matter.
IMO both of their descriptions are already pretty clear.
You can see in this PR an attempt to explicit and focus on the context in which they are requested.
Any idea or suggestions are welcome.