To achieve the multi select you want, you must set the properties multiple
and expanded
to true
.
$builder->add('fruits', ChoiceType::class, [
'multiple' => true,
'expanded' => true
'choices' => [
'bananas' => 1,
'apples' => 2,
'oranges' => false,
],
]);
Details here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…