Twig forgets array-keys Twig forgets array-keys arrays arrays

Twig forgets array-keys


also you can try this :

{% for key,value in users %}    {{ key }}{% endfor %}

or maybe look into the "loop" object defined in the for loop

http://twig.sensiolabs.org/doc/tags/for.html


Maybe this

http://www.twig-project.org/doc/templates.html

By default, a loop iterates over the values of the sequence. You can iterate on keys by using the keys filter:

<h1>Members</h1><ul>  {% for key in users|keys %}    <li>{{ key }}</li>  {% endfor %}</ul>


It's not related on twig, it's a known gap in doctrine-mongodb using embeddedDocuments. Doctrine can't handle key-Values from embeddedDocuments, it will reorder the keys beginning from 0 and will so ignore the right key-values. Thank you anyway for your help :).