title: Symfony2 & Twig : display all fields and keys
body: <p>I have a problem with Symfony2 and Twig: I don't know how to display all fields of my entity which is loaded dynamically. Here is my code (displays nothing!!)</p>
  
  <p>Controller :</p>
  
  <pre><code>public function detailAction($id)
  {
      $em = $this-&gt;container-&gt;get('doctrine')-&gt;getEntityManager();
  
      $node = 'testEntity'
      $Attributes = $em-&gt;getRepository('TestBetaBundle:'.$node)-&gt;findOneById($id);
  
      return $this-&gt;container-&gt;get('templating')-&gt;renderResponse('TestBetaBundle:test:detail.html.twig', 
      array(
      'attributes' =&gt; $Attributes
      ));
  
  }
  </code></pre>
  
  <p>detail.html.twig :</p>
  
  <pre><code>    {% for key in attributes %} 
          &lt;p&gt;{{ value }} : {{ key }}&lt;/p&gt;
      {% endfor %}
  </code></pre>