public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('agency', EntityType::class, [
'placeholder' => "select agency",
"choice_label" => "getName",
"class" => Agency::class,
"label" => "Associée à l'agence",
"required" => false,
]);
}
如何为例子手动添加默认选项:
// agencies from DB
agancy1
agency2
agency3
test // add test manually