手动添加默认选项

时间:2017-03-02 10:58:38

标签: forms symfony

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 

0 个答案:

没有答案