I am trying to get the data from the db using array index however i do not want to iterate.
content table:
|id| content |active
|1|this is first content |yes
|2| This is secound Content| yes
Controller.php:
$em = $this->getDoctrine()->getManager();
$entities= $em->getRepository('TestCMSBundle:Content\Content')->GetContents();
return $this->render('TestCMSBundle:Default:index.html.twig', array('entities' => $entities));
mytwig:
{{ entities.content[0] }}
some other contents.... blah blah
{{ entities.content[1]}}
but i canot seems to get the content.
Error: Key "content" for array with keys "0, 1" does not exist in TestCMSBundle:index.html.twig at line 80
please i do not want to iterate over the loop like:
{% for entity in entities %}
{{ entity.content}}
{%endfor%}