无论如何都要在表单元素中创建分层复选框吗?
我的学说实体“税”可以有父母。
我在一个表格中定义了这个引用税收的字段。
$builder->add('impuestos', 'entity', array(
'class' => 'MyBundle:Tax',
'label' => 'Taxes',
'multiple' => true,
'expanded' => true));
我正在Google上查看Symfony文档和来源,我无法想象如何以分层方式显示此字段。
我需要的是这样的事情:
[] Parent Tax 1
-- [] Child 1 of parent tax 1
-- [] Child 2 of parent tax 1
[] Parent Tax 2
-- [] Child 1 of parent tax 2
-- [] Child 2 of parent tax 2
答案 0 :(得分:0)
我知道这是一个老问题,但请参阅http://shout.setfive.com/2014/10/24/symfony2-outputting-form-checkboxes-in-a-hierarchy/(不是我的链接)了解答案。我还在试图弄清楚如何深入三层......