我有一个这样的表格:
$form = $this->get('form.factory')->createBuilder(FormType::class, $user)
->add('planningday', ChoiceType::class, array(
'label' => 'Sélectionnez un jour',
'choices' => array(
'Lundi' => 1,
'Mardi' => 2,
'Mercredi' => 3,
'Jeudi' => 4,
'Vendredi' => 5
)
))
->add('planningcontent', TextType::class, array( 'label' => 'Description'))
->add('S\'inscrire au planning', SubmitType::class)
->getForm();
我想根据关联数组禁用一些选择值:
array (size=5)
1 => boolean true
2 => boolean false
3 => boolean false
4 => boolean false
5 => boolean false
如何使用关联数组将值放入表单中?
我想基于关联数组传递像required = true / false这样的东西