I'm using SILEX with twig and I'm trying to achieve an count for an array from db with a specific value Here is the piece of code to be more specific:
<p>There are in total {{ items|length }}</p> // returns the GOOD amount of total rows in db
<p>There are {{ items.stare=='activ'|length }} requests not answered.</p> // returns nothing
How can I achieve what I want?
items is an array with information from a SELECT *
EDIT
I'm sorry , the second returns nothing only when using an for(items as item) When I use items.stare I get a twig error:
Key "stare" for array with keys "0, 1, 2, 3, 4" does not exist in "index.twig" at line 78