【发布时间】:2017-03-01 12:33:32
【问题描述】:
我正在使用 a2lix/TranslationFormBundle 并尝试添加一个 EntityType 字段。
当我尝试构建表单时出现此错误:
The option "0" does not exist. Known options are: "action", "attr", "auto_initialize", "block_name", "by_reference", "compound", "csrf_field_name", "csrf_message", "csrf_protection", "csrf_provider", "csrf_token_id", "csrf_token_manager", "data", "data_class", "disabled", "empty_data", "error_bubbling", "inherit_data", "intention", "label", "label_attr", "label_format", "mapped", "max_length", "method", "pattern", "post_max_size_message", "property_path", "read_only", "required", "translation_domain", "trim", "virtual"
这是我的表单类型
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use A2lix\TranslationFormBundle\Form\Type\TranslationsType;
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('tag', TextType::class)
->add('translations', TranslationsType::class, [
'fields' => [
'promotion' => ['field_type' => EntityType::class, [
'class' => 'AdminBundle:Promotion',
'choice_label' => 'getName'
] ]
]
])
->add('Save', SubmitType::class)
;
}
当我在 TranslationType 字段之外使用 EntityType 字段时,它可以正常工作。但是当我在 TranslationType 中使用它时,它不会。
任何帮助将不胜感激
【问题讨论】:
标签: symfony entity formbuilder