Symfony集合无法在控制器中检索集合值

时间:2018-08-31 13:11:04

标签: php symfony

我有一个实体MyEntity,其中包含一组语言。

对于语言,我们有两个字段(语言和niveaux) 下面是如何将集合添加到表单中。

 ->add('langues', CollectionType::class, 
            array(
            'entry_type' => LangueparleeType::class,
            'entry_options' => array('label' => false),
            'allow_add'    => true,
            'allow_delete'  => true,
            'by_reference' => false,
            'prototype'     => true,
            ))

现在显示从表单到另一个树枝的集合以进行定价:

{% for langue in candidat.langues %}  
       <div class="form-group col-xs-4">
          <label class="font-weight-bold" > Langues </label>  <input class="form-control"  value = "{{ langue.langues }}" />
       </div>
        <div class="form-group col-xs-4">
          <label class="font-weight-bold" > Langues </label>  <input class="form-control"  value = "{{ langue.niveaux }}" />
       </div>
    {% endfor %}

我只能获取第一个值(语言),但不能获取niveaux

0 个答案:

没有答案