-
-
Notifications
You must be signed in to change notification settings - Fork 329
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
[LiveComponent] Fix ComponentWithFormTrait::extractFormValues()
with edge cases
#2491
base: 2.x
Are you sure you want to change the base?
Conversation
I can confirm that this patch resolved my specific case with custom form type and "choices" option. Thank you. |
Something is more going on here. While #2490 works for me |
I think it could happen when form has some ChoiceType field, which has 'choices' set as empty array. In that case Seems that some additional check is needed (if 'choices' is array and if it is not empty?) |
Entirely my fault here. As you can see here i checked for the "choices" existence. I decided later on to "optimize" and moved the check first, adding an isset in the operation when the key was not defined.... and losing then my original goal: ensure there is one value. |
This should work better now. Thank you very much to both of you. |
#2403 fixed an old bug to simulate browser behaviour when a select field has no option selected, no placeholder, and is required (it then uses the first option)
#2425 and #2426 fixed the way we handled empty strings as placeholders
In #2487 @maciazek explained us how a custom type with a "choices" option became unusable since the last changes.
Also.. while I was reading all this I realized we returned wrong values here when "option groups" were used.. leading to other problems.
I updated the code of
extractFormValues()
method to:ChoiceType::buildView
were defined in the$view->vars
, to ensure we are dealing with a<select>
field built by aChoiceType