title: Get value from collection field in Twig
body: <p>I have collection form and need to access the value to show in my view. The problem is seems the key variable declared as Integer and I got error like this :</p>
  
  <blockquote>
    <p>Impossible to access an attribute ("nama") on a integer variable ("0")
    in SifoAdminBundle:DftAbsensi:manage.html.twig at line 65</p>
  </blockquote>
  
  <p>Here my Twig :</p>
  
  <pre><code>{% for key, absensi in form_edit %}
      &lt;li&gt;{{ form_edit.vars.value.statusS.key.nama }}&lt;/li&gt;
  {% endfor %}
  </code></pre>
  
  <p>If I change <code>{{ form_edit.vars.value.statusS.key.nama }}</code> into <code>{{ form_edit.vars.value.statusS.1.nama }}</code> its works fine.</p>
  
  <p>Here my controller :</p>
  
  <pre><code>/* Show data */
          $emShow = $this-&gt;getDoctrine()-&gt;getManager();
          $collectionAbsensi = new CollectionAbsensi();
          foreach ($entityGrupPelajar as $temp) {
              $entity = new DftAbsensi();
              $entity = $emShow-&gt;getRepository('SifoAdminBundle:DftAbsensi')-&gt;findOneBy(array('idGrupPelajar' =&gt; $temp, 'tanggal' =&gt; $tanggal));
              if ($entity)
              {
                  $entityPelajar = $emShow-&gt;getRepository('SifoAdminBundle:MstPelajar')-&gt;find($temp-&gt;getIdPelajar());
                  $dftAbsensi = new DftAbsensi();
                  $dftAbsensi-&gt;setId($entity-&gt;getId())
                      -&gt;setIdGrupPelajar($entity-&gt;getIdGrupPelajar())
                      -&gt;setTanggal($entity-&gt;getTanggal())
                      -&gt;setStatus($entity-&gt;getStatus())
                      -&gt;setNis($entityPelajar-&gt;getNis())
                      -&gt;setNama($entityPelajar-&gt;getNama())
                  ;
                  $collectionAbsensi-&gt;getStatusS()-&gt;add($dftAbsensi);
              }
          }
          $emShow-&gt;flush();
  
          $formEdit = $this-&gt;createForm(new CollectionAbsensiType(), $collectionAbsensi);
          $formEdit-&gt;add('save', 'submit', array('attr' =&gt; array('class' =&gt; 'btn btn-info')));
  
          return $this-&gt;render('SifoAdminBundle:DftAbsensi:manage.html.twig', array(
              'form_edit'      =&gt; $formEdit-&gt;createView(),
          ));
  </code></pre>
  
  <p>I have searched for this problem also read the issue <a href="https://github.com/fabpot/Twig/issues/902" rel="nofollow noreferrer">#902</a> but still this problems occurs in my Symfony 2.4 on PHP 5.4</p>
  
  <p>Is there any ways to get that value in iteration without key?</p>