// <select> tag with "multiple" option or list of checkbox inputs
$builder->
addViewTransformer(new ChoicesToValuesTransformer($choiceList));
} else { // <select> tag without "multiple" option or list of radio inputs
$builder->
addViewTransformer(new ChoiceToValueTransformer($choiceList));
} if ($options['multiple'
] &&
$options['by_reference'
]) { // Make sure the collection created during the client->norm
// transformation is merged back into the original collection
$builder->
addEventSubscriber(new MergeCollectionListener(true, true
));
} // To avoid issues when the submitted choices are arrays (i.e. array to string conversions),
// we have to ensure that all elements of the submitted choice data are NULL, strings or ints.
$builder->
addEventListener(FormEvents::PRE_SUBMIT,
static function DFormEvent
$event) { $data =
$event->
getData();
if (!\
is_array($data)) { return;
}