在 ArrayCollection Symfony2 中嵌入表单
Embed form in ArrayCollection Symfony2
我有表格:
我的 Tag1 代码如下:
$builder
->add('tag1', 'collection', [
'type' => 'text',
'label' => 'Tag1',
'allow_add' => true,
'allow_delete' => true,
'prototype' => true,
'options' =>
[
'required' => false,
'label' => false
]
])
但是如何在字段中添加子表单?
谢谢!
嗨,我认为这很简单。
$builder
->add('tag1', 'collection', [
'type' => new yourSubFormType(),
...
])
更多信息:http://symfony.com/doc/current/cookbook/form/form_collections.html
我有表格:
我的 Tag1 代码如下:
$builder
->add('tag1', 'collection', [
'type' => 'text',
'label' => 'Tag1',
'allow_add' => true,
'allow_delete' => true,
'prototype' => true,
'options' =>
[
'required' => false,
'label' => false
]
])
但是如何在字段中添加子表单? 谢谢!
嗨,我认为这很简单。
$builder
->add('tag1', 'collection', [
'type' => new yourSubFormType(),
...
])
更多信息:http://symfony.com/doc/current/cookbook/form/form_collections.html