I would like to know if it was possible to cast a String to an Int in twig. I try to see if a user has enough credit or not to buy a cours. For that, I calculate the amount of credit with a render in the template (because I need the value in the template, and I didn't found a better way to do it...) like this :
{% set creditUser %}
{{render(controller('L3L2EntraideBundle:Credits:sommeCredits'))}}
{% endset %}
But when I try to compare creditUser :
{% if creditUser < c.idCompetenceCours.prix %}disabled="false"{% endif %}
Symfony return me a beautiful error : An exception has been thrown during the rendering of a template ("Notice: Object of class Twig_Markup could not be converted to int") in L3L2UserBundle:Profile:modal_prendre_rdv.html.twig at line 21.
Any idea ? Thank you in advance for my first question on Stackoverflow and sorry for my english.