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] Filter arrays out of scalar form types#29307
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
src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
HeahDude left a comment
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.
Thanks! Finally closing this old issue 🎉
Uh oh!
There was an error while loading.Please reload this page.
f3d312f to60faaf1Comparenicolas-grekas commentedNov 25, 2018
Now with tests, ready. |
| )); | ||
| } | ||
| publicfunctiontestSubmitWithNonStringDataDoesNotBreakTheFixUrlProtocolListener() |
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.
Interesting test 😄
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedNov 25, 2018
"multiple" is exactly the info we're missing to decide if we allow arrays or not: form types that know how to deal with array of values don't have to be compound, and "multiple" is their way to express they still deal with arrays. Note that this is already what we use, that's why the patch is so simple yet it works and tests are green. |
ro0NL commentedNov 26, 2018 • 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.
Can we check if the type is actual multiple, i.e. Is the same check needed vice versa? If the submitted data is scalar and the type is compound/multiple? |
nicolas-grekas commentedNov 26, 2018 • 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.
@ro0NL that's how I first wrote the patch, but the tests broke all around. The reason is that we don't need to decide if arrays are allowed. Instead we need to decide if arraysare dealt with at the form type level. All form types that declare multiple true/false can do that. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
nicolas-grekas commentedDec 7, 2018 • 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.
rebased - ready |
…kas)This PR was merged into the 3.4 branch.Discussion----------[Form] Filter arrays out of scalar form types| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#4102| License | MIT| Doc PR | -Replacesfix#20935Commits-------000e4aa [Form] Filter arrays out of scalar form types
…nges (Zales0123)This PR was merged into the 1.2 branch.Discussion----------| Q | A| --------------- | -----| Branch? | 1.2| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Related tickets | related tosymfony/symfony#29307| License | MITDue to the latest Symfony 4.1.10/3.4.21 release and changes introduced in linked PR, a bug in select attribute type araised 🌤 Apparently, possible to select values in attribute configuration was saved with `TextType` form type, even though `SelectAttributeValueTranslationsType` should be used. It was somehow parsed before, but know it's not possible and this PR fixes this absurdity 🖖 Commits-------51f7ec2 Fix select attributes according to recent Symfony form changesb80fa00 Fix test in ResourceBundle (taken from#10062)
…nges (Zales0123)This PR was merged into the 1.2 branch.Discussion----------| Q | A| --------------- | -----| Branch? | 1.2| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Related tickets | related tosymfony/symfony#29307| License | MITDue to the latest Symfony 4.1.10/3.4.21 release and changes introduced in linked PR, a bug in select attribute type araised 🌤 Apparently, possible to select values in attribute configuration was saved with `TextType` form type, even though `SelectAttributeValueTranslationsType` should be used. It was somehow parsed before, but know it's not possible and this PR fixes this absurdity 🖖 Commits-------51f7ec2481d67270ed66b9879fc57702e4fafb76 Fix select attributes according to recent Symfony form changesb80fa003a4a279c9204465b6189027db50c2285e Fix test in ResourceBundle (taken from #10062)
…nges (Zales0123)This PR was merged into the 1.2 branch.Discussion----------| Q | A| --------------- | -----| Branch? | 1.2| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Related tickets | related tosymfony/symfony#29307| License | MITDue to the latest Symfony 4.1.10/3.4.21 release and changes introduced in linked PR, a bug in select attribute type araised 🌤 Apparently, possible to select values in attribute configuration was saved with `TextType` form type, even though `SelectAttributeValueTranslationsType` should be used. It was somehow parsed before, but know it's not possible and this PR fixes this absurdity 🖖 Commits-------51f7ec2481d67270ed66b9879fc57702e4fafb76 Fix select attributes according to recent Symfony form changesb80fa003a4a279c9204465b6189027db50c2285e Fix test in ResourceBundle (taken from #10062)
bvisonl commentedJan 9, 2019 • 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.
I was using the type of |
TrickyC94 commentedJan 11, 2019 • 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.
I'm on the same situation. Things worked before this update |
omarboussarsar commentedApr 25, 2019 • 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.
This code can help you to bind an array with a TextType by serializing the array before the submit. $builder->addEventListener(FormEvents::PRE_SUBMIT,function (FormEvent$event) {$event->setData(array_map(function ($value) {returnserialize($value); },$event->getData()));}) |
Uh oh!
There was an error while loading.Please reload this page.
Replacesfix#20935