I am usign Symfony 3 with Doctrine for get data from db, after get the data, it send to client for add to datatable.
For use the data in the datatable I need a array as follow:
[
{"id":1
"app": "stack"},
{"id":2
"app": "reddit"}
]
But when I do the query as follow:
$qb = $this->getEntityManager()->createQueryBuilder();
return $qb = $qb->select('a')
->from('AppsBundle:App', 'a')
->orderBy('a.'.$columnOrder, $order)
->setFirstResult($start)
->setMaxResults($length)
->getQuery()
->getResult(\Doctrine\ORM\AbstractQuery::HYDRATE_ARRAY);
I get as "json object arrat" as follow:
{
"0": {"id":1
"app": "stack"},
"1": {"id":2
"app": "reddit"}
]
Any idea for get the data as the other representation.
Thanks