I know its a very silly question but having issues with symfony and doctrine createQuery..
I need an array result like this way to feed my chart app:
array (size=6)
0 =>
array (size=2)
0 => string 'Firefox' (length=7)
1 => float 45
1 =>
array (size=2)
0 => string 'IE' (length=2)
1 => float 26.8
2 =>
array (size=2)
0 => string 'Chrome' (length=6)
1 => float 12.8
and im using this query:
$query = $this->getEntityManager()->createQuery(
'SELECT c.status, COUNT (c.status) FROM MyAppBundle:Content c GROUP BY c.status '
);
$results = $query->getArrayResult();
but its returning like this:
array (size=4)
0 =>
array (size=2)
'status' => string 'Converted' (length=9)
1 => string '4359' (length=4)
1 =>
array (size=2)
'status' => string 'Received Q' (length=10)
1 => string '277' (length=3)
2 =>
array (size=2)
'status' => string 'Signed' (length=6)
1 => string '1' (length=1)
3 =>
array (size=2)
'status' => string 'Uploaded' (length=8)
1 => string '1' (length=1)
Now in regular php and mysql:
while($row = mysql_fetch_array($query,MYSQL_NUM)){
$results[] = $row ;
}
can return the array result as expected but my q is how can i do it with symfony2 and doctrine way?