title: Entity print loop for in Twig
body: <p>I'm trying to make a dynamic twig template to print lists of Entities with different number of fields. The whole point is that I can't print all the columns of <code>$lligues</code>.</p>
  
  <p>My controller looks like this:</p>
  
  <pre><code>    /**
      * @Route("/llistarlliga",name="llistar_lliga")
      */
      public function llistarLliga(){
          $repository = $this-&gt;getDoctrine()-&gt;getRepository('AppBundle:Lliga');
  
          $camps = array('Nom','Nº equips','Accions');
          $lligues = $repository-&gt;findAll();
          return $this-&gt;render('templates/list.html.twig', array('camps' =&gt; $camps, 'lligues' =&gt; $lligues,
                                                                  'title' =&gt; 'Llistat de lligues'));
      }
  </code></pre>
  
  <p>Twig template:</p>
  
  <pre><code>{# app/Resources/views/forms/lista.html.twig #}
  {% extends "templates/home.html.twig" %}
  {% block title %}
      {{title}}
  {% endblock %}
  {% block body %}  
      &lt;table&gt;
          &lt;thead&gt;
              {% for i in 0..camps|length-1 %}
                  &lt;th&gt;{{camps[i]}}&lt;/th&gt;
              {% endfor %}
          &lt;/thead&gt;
          &lt;tbody&gt;
              {% for lliga in lligues %}
                  &lt;tr&gt;
                      &lt;td&gt;{{lliga.nom}}&lt;/td&gt;
                      &lt;td&gt;{{lliga.numequips}}&lt;/td&gt;
                      &lt;td&gt;
                          &lt;a href="{{ path('borrar_lliga', {'nom' : lliga.nom}) }}"&gt;&lt;img src="{{ asset('images/bin.png') }}" /&gt;&lt;/a&gt;
                          &lt;a href="{{ path('modificar_lliga', {'nom' : lliga.nom}) }}"&gt;&lt;img src="{{ asset('images/edit.png') }}" /&gt;&lt;/a&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              {% endfor %}
          &lt;/tbody&gt;
      &lt;/table&gt;
  {% endblock %}
  </code></pre>
  
  <p>So, I would like to change the second loop (for lliga in lligues) to make it dynamic, so if it has more fields or less, it prints them too.</p>
  
  <p>Thanks to everyone!</p>