title: count relations inside loop in twig
body: <p>I use Symfony2 and twig templating. Think of the Q&amp;A exact same as stackoverflow. There are list of questions with the count of score, answers, views and so on. How to count the answers of the qeustions inside loop in twig? There are OneToMany relation between Question and Answer tables.</p>
  
  <pre><code>{% for question in questions %}
      &lt;li&gt;{{ question.score }}&lt;/li&gt;
      &lt;li&gt;{# there should be the count // count($question-&gt;getAnswers()) #}&lt;/li&gt;
      &lt;li&gt;{{ question.view }}&lt;/li&gt;
  {% endfor %}
  </code></pre>
  
  <p>Or if there is any better way to achieve this, I am open to suggestions.</p>