-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Form] do not accept array input when a form is not multiple (regression) #46519
Comments
@xabbuh Not sure if it's the best way to fix the issue but I could resolve it by setting $data = $event->getData(); with $data = $event->getForm()->getExtraData(); |
This is interesting change, we used same functionality to accept entities selection, from external web hook, {
item: {id: 111, description: "XXXXXX"},
category: {id: 2, name: "YYYYY"}
} While we can reduce objects to ID in PRE_SUBMIT it will require change to tens if not hundreds of forms. |
Hey, thanks for your report! |
For me this is still relevant. It would be really helpful if there was a way to use transformers before this check is made. |
Hey, thanks for your report! |
Friendly ping? Should this still be open? I will close if I don't hear anything. |
Hello. |
Hey, thanks for your report! |
Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3 |
Hello. |
Symfony version(s) affected
6.1.0
Description
Hi,
From the following commit 6bffdbc I got a regression because in a specific FileType component I can enable the support for single or multiple upload. But when using a single upload I always post an array that contains metadata of a single element (file). So the field is set as
multiple=false
, andcompound=false
but I submit an array that I transform to a file entity.Now, I got a
TransformationFailedException
with message: Submitted data was expected to be text or number, array given.For me it's important to provide at least the id of file (if it exists) and the file name to support the update of file. I tried to set the field as compound but it leads to other issues, as I always receive an empty File entity as data in my listener (on submit).
I don't understand why the the submitted data corresponding to a field (not multiple or compound) should not be an array.
BlueimpFileType:
BlueimpFileListener:
view:
How to reproduce
Send data as array (metadata of single filed) on non multiple / compound field.
Possible Solution
Revert the previous commit?
Additional Context
No response
The text was updated successfully, but these errors were encountered: