Php Symfony 2实体表单字段
我有一个带有实体字段的细枝模板,当我使用它两次时,它就不起作用了。例如:Php Symfony 2实体表单字段,php,html,symfony,twig,Php,Html,Symfony,Twig,我有一个带有实体字段的细枝模板,当我使用它两次时,它就不起作用了。例如: <div class="control-group"> <label class="control-label">Secondary</label> <div class="controls"> {% if entity.category and entity.category.parent %} <span st
<div class="control-group">
<label class="control-label">Secondary</label>
<div class="controls">
{% if entity.category and entity.category.parent %}
<span style="margin-right:5px;">{{ entity.category.parent.name }} ›</span>
{% endif %}
{{ form_errors(edit_form.categories) }}
{{ form_widget(edit_form.categories) }}
</div>
</div>
次要的
{%if entity.category和entity.category.parent%}
{{entity.category.parent.name}}›
{%endif%}
{{form_errors(edit_form.categories)}
{{form_小部件(编辑_form.categories)}
如果我这样做:
<div class="control-group">
<label class="control-label">Secondary</label>
<div class="controls">
{% if entity.category and entity.category.parent %}
<span style="margin-right:5px;">{{ entity.category.parent.name }} ›</span>
{% endif %}
{{ form_errors(edit_form.categories) }}
{{ form_widget(edit_form.categories) }}
</div>
</div>
<div class="control-group">
<label class="control-label">Secondary 2</label>
<div class="controls">
{% if entity.category and entity.category.parent %}
<span style="margin-right:5px;">{{ entity.category.parent.name }} ›</span>
{% endif %}
{{ form_errors(edit_form.categories) }}
{{ form_widget(edit_form.categories) }}
</div>
</div>
次要的
{%if entity.category和entity.category.parent%}
{{entity.category.parent.name}}›
{%endif%}
{{form_errors(edit_form.categories)}
{{form_小部件(编辑_form.categories)}
中二
{%if entity.category和entity.category.parent%}
{{entity.category.parent.name}}›
{%endif%}
{{form_errors(edit_form.categories)}
{{form_小部件(编辑_form.categories)}
标签已写入,但无法获取“选择标签”框。经过研究,我得出结论:复制实体是不可能的?当我这样做时,你需要使用:表单的视图数据应该是类的实例。你需要创建一个表单,为实体保存表单。这样,您就可以为实体类型的多个实例指定一个表单