I make a listing of some products and would need to return the largest and smallest value of the products without using max and min in the SQL query. I've tried using Twig's max () function but it returns some errors. Here is what I did and the error that is happening:
Code:
{% for product in produtos %}
{% set maxValue = max(product.valor)%}
Valor--->>{{maxValue}}
{% endfor %}
Error:
An exception has been thrown during the rendering of a template ("max() [<a href='function.max'>function.max</a>]: When only one parameter is given, it must be an array")