Bonjour,

je suis entrain de travailler sur symfony2 et une base oracle, le problème c'est lorsque je fait la division dans la requête j'aurai plusieurs nombre après le virgule et j'aime me limiter à deux chiffre après le virgule.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
 
	$posts3 = $this->get('doctrine')->getEntityManager()
            ->createQuery("SELECT p.codcpt , p.quanti, p.prirev/p.quanti AS prirevient ,e.libcou ,e.valcou,e.valcou * p.quanti AS valo,(e.valcou - (p.prirev/p.quanti)) * p.quanti AS value
			FROM CGFPortfolioBundle:VposiT p , CGFPortfolioBundle:VtitrT e where p.codtit=e.codtit and p.quanti >0 and p.codcpt=(SELECT t.codcpt 
			FROM CGFPortfolioBundle:VcptmT t where t.codcli=  '$cl') " )
            ->execute();
twig:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
	{% for a in posts3 %}
	<tr class="tr">
 
		<td class="td" style="text-align:left;">{{ a.libcou}}</td>
		<td class="td">{{ a.quanti }}</td>		
		<td class="td">{{ a.prirevient }}</td>
		<td class="td">{{ a.valcou }}</td>	
        <td class="td">{{ a.valo }}</td>
 
{% endfor %}
résultat : 19,86290857142857142857142857142857142857



Merci,