如何在symfony 3中将集合添加到集合形式

时间:2018-06-25 08:51:49

标签: symfony collections symfony-3.3

我在symfony 3中有3种表单类型

PanneauType,它是所有下一个集合的父项

            ->add('faces', CollectionType::class, array(
                'entry_type' => FacePanneauType::class,
                'entry_options' => array('label' => false),
                'allow_add' => true,
                'allow_delete' => true,
            ))

FaceType

->add('agendas', CollectionType::class, array(
                'entry_type' => AgendaType::class,
                'entry_options' => array('label' => false),
                'allow_add' => true,
                'allow_delete' => true,
                'attr' =>['class'=>'agendas']
            ))

AgendaType

->add('debut', null, ['attr'=>['class'=>'form-control']])
 ->add('fin', null, ['attr'=>['class'=>'form-control']])

如何在树枝中生成我的表单,添加和删除议程类型?

1 个答案:

答案 0 :(得分:0)

这就是您要寻找的:

https://symfony.com/doc/current/form/form_collections.html

为此,您将需要一些Javascript:)