I'm trying to make a count request on an id field.
I have the following code in my controller:
$qb = $em->createQueryBuilder();
$qb->select('count(c.id)')
->from('MyBundle:Category', 'c')
->where('c.author = :aut')
->setParameter('aut', $author);
$result = $qb->getQuery()->getResult();
return $this->render('MyCategoryBundle:Category:categories.html.twig', array(
'categories' => $categories,
'result' => $result
));
And in my view.html.twig :
{% for category in categories %}
<li>
{{ category.title }}
{% for total in result %}
{{ total }}
{% endfor %}
</li>
{% endfor %}
It returns the category title and the string "Array" just besides. What am I doing wrong ?