Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Form] Fixed empty data for compound date types#29182
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
HeahDude commentedNov 11, 2018
| Q | A |
|---|---|
| Branch? | 2.8 |
| Bug fix? | yes |
| New feature? | no |
| BC breaks? | no |
| Deprecations? | no |
| Tests pass? | yes |
| Fixed tickets | #4715 |
| License | MIT |
| Doc PR | ~ |
90a0ab0 tod53e21aCompared53e21a to9bab1e8CompareHeahDude commentedNov 12, 2018
To give more context,https://github.com/symfony/symfony/pull/29179/files#diff-1c1084613d7579bc9e39092ac95364f9R1020 is the test revealing the inconsistency prior to fix compound cases in this PR. |
nicolas-grekas commentedNov 15, 2018
Thank you@HeahDude. |
This PR was merged into the 2.8 branch.Discussion----------[Form] Fixed empty data for compound date types| Q | A| ------------- | ---| Branch? | 2.8| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#4715| License | MIT| Doc PR | ~Commits-------9bab1e8 [Form] Fixed empty data for compound date types
This PR was merged into the 3.4 branch.Discussion----------[Form] Fixed empty data for compound date interval| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#4715 (continuation)| License | MIT| Doc PR | ~Following#29182, since this type has been introduced in Symfony 3 but with the same limitation explained in#4715.So for consistency this needs to be fixed here as well.Commits-------38a2abc [Form] Fixed empty data for compound date interval
| 'data_class' =>null, | ||
| 'compound' =>$compound, | ||
| 'empty_data' =>function (Options$options) { | ||
| return$options['compound'] ?array() :''; |
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.
Hi@nicolas-grekas ,
Could you explain, why empty data is empty string instead of null as it was before?
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.
We are usingDateTimeToRfc3339Transformer, and it's expecting null as an empty value, otherwise throws an exception, and probably the same issue will be withDateTimeToLocalizedStringTransformer
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.
empty_data is in the view format. This value should not be passed totransform() but toreverseTransform(). Can you please open a new issue with fine steps that allow to reproduce if you think you found a bug?
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.
Hm, based on examples from thedocumentation and according to thecode I thoughtempty_data is a model format, not view, as it could benew $data_class().
Need to investigate then.
Thank you for the fast response!
…/Time form types (yceruto)This PR was merged into the 3.4 branch.Discussion----------[Form] Fix handling of empty_data's \Closure value in Date/Time form types| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#33188| License | MIT| Doc PR | -Basically this would solve the posibility to pass a `\Closure` to the `empty_data` option for Date/Time form types.>https://symfony.com/doc/current/reference/forms/types/form.html#empty-data> If a form is compound, you can set empty_data as an array, object or **closure**. See the [How to Configure empty Data](https://symfony.com/doc/current/form/use_empty_data.html) for a Form Class article for more details about these options.Also related to#29182Commits-------4939f0e Fix handling of empty_data's \Closure value in Date/Time form types
…/Time form types (yceruto)This PR was merged into the 3.4 branch.Discussion----------[Form] Fix handling of empty_data's \Closure value in Date/Time form types| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets | Fix #33188| License | MIT| Doc PR | -Basically this would solve the posibility to pass a `\Closure` to the `empty_data` option for Date/Time form types.>https://symfony.com/doc/current/reference/forms/types/form.html#empty-data> If a form is compound, you can set empty_data as an array, object or **closure**. See the [How to Configure empty Data](https://symfony.com/doc/current/form/use_empty_data.html) for a Form Class article for more details about these options.Also related tosymfony/symfony#29182Commits-------4939f0e323 Fix handling of empty_data's \Closure value in Date/Time form types