I\'m using this:
$this->getDoctrine()->getRepository(\'MyBundle:MyEntity\')->findAll(array(), Query::HYDRATE_ARRAY);
I thought that sh
Use getScalarResult()
to get an array result with objects truncated to strings.
According to this EntityRepository class, findAll
don't take multiple arguments.
The code below should do what you want
$result = $this->getDoctrine()
->getRepository('MyBundle:MyEntity')
->createQueryBuilder('e')
->select('e')
->getQuery()
->getResult(\Doctrine\ORM\Query::HYDRATE_ARRAY);
You can also use the getArrayResult()
function instead of getResult()
. It returns an array of data instead:
$query = $em->createQuery("SELECT test FROM namespaceTestBundle:Test test");
$tests = $query->getArrayResult();