How to get Array Results in findAll() - Doctrine?
It's possible to use $query->getArrayResult()
as a shortcut to $query->getResult(Query::HYDRATE_ARRAY)
doctrine hydration modes
The findAll()
method does not have any parameters. You can, for example, use the repository's createQueryBuilder()
method to achieve what you want to do:
use Doctrine\ORM\Query;
// ...
$query = $this->getDoctrine()
->getRepository('CoreBundle:Categories')
->createQueryBuilder('c')
->getQuery();
$result = $query->getResult(Query::HYDRATE_ARRAY);