score:45

Accepted answer

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);

score:-1

Use getScalarResult() to get an array result with objects truncated to strings.

score:27

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();

Related Query

More Query from same tag