Division of Two Variables in Twig file.
symfony, twig
Solution
I think you have to use two slashes, i.e.
{{ (sanstha_actual // sanstha_target) * 100 }}
as shown in the documentation:
//: Divides two numbers and returns the floored integer result. {{ 20 // 7 }} is 2
Problem
I have the following two variables in twig file. ``` {%set sanstha_target%} {%render 'FrontBundle:Datasheet:getCurrentTarget' with {'dealer':recent_entry.id,'month':recent_entry.year~recent_entry.month,'type':'3'}%} {%endset%} {%set sanstha_actual%} {%render 'FrontBundle:Datasheet:getTotal' with {'datasheet':recent_entry.datasheet,'dealer':recent_entry.id,'type':'3'}%} {%endset%} ``` The when I am going to divide this getting this error: ``` An exception has been thrown during the rendering of a template ("Notice: Object of class Twig_Markup could not be converted to int... ``` I need to get the percentage like this ``` {{ (sanstha_actual/sanstha_target)*100}} ```