Doctrine queryBuilder: return object not array

Viewed 14644

I have this query created with doctrine querybuilder, the return i get is an array of arrays. I would like to get a return that is an array of objects, is this possible?

I know that normally Doctrine returns objects of an entity, bit since i have an inner join to get the name from another table it returns arrays.

Thanks in advance.

   $qb->select('u', 'h.name')
        ->from('AppBundle:UserHose', 'u')
        ->innerJoin('AppBundle:Hose', 'h', 'WITH', 'u.hoseId = h.id')
        ->where('u.userId = :userId')
        ->orderBy('u.id', 'DESC')
            ->setParameter('userId', $userId); 


    return $qb->getQuery()->getResult();
4 Answers
Related