Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5e0f832

Browse files
committed
fetch all known ChoiceType values at once
1 parent 8e93517 commit 5e0f832

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
165165
}
166166
}
167167
} else {
168-
foreach ($data as $value) {
169-
if ($choiceList->getChoicesForValues([$value])) {
170-
$knownValues[] = $value;
171-
unset($unknownValues[$value]);
172-
}
168+
foreach ($choiceList->getChoicesForValues($data) as $key => $choice) {
169+
$knownValues[] = $data[$key];
170+
unset($unknownValues[$data[$key]]);
173171
}
174172
}
175173

0 commit comments

Comments
 (0)