Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
http://meta.stackoverflow.com/q/137230/182741
Link
j0k
  • 22.8k
  • 28
  • 81
  • 90
Source Link
scc
  • 10.8k
  • 11
  • 53
  • 68

Symfony2 and Doctrine - return database result as array of arrays in controller

Doing this in a symfony2 controller results in an array where each single result is itself an object.. but i need it to be an array as well so i can easily json_encode the whole list

$em->getRepository('MyBundle:Report')->findByEvaluation($evaluation_id, \Doctrine\ORM\Query::HYDRATE_ARRAY) 

So how do i get an array of arrays and not an array of objects which is what i'm getting by using HYDRATE_ARRAY?