views:

46

answers:

1

Hi, I try to do this query using doctrine query builder

$idAccount = $params['idAccount'];
$qb = $this->_em->createQueryBuilder()->select('t,tt')
                ->from($this->_entityName, 'sr')
                ->innerJoin('sr.account', 'a')
                ->innerJoin('sr.product', 'p')
                ->leftJoin('p.title', 't')
                ->leftJoin('p.set', 's')
                ->leftJoin('s.idTitle', 'tt');
        $qb->where($qb->expr()->eq('a.idAccount',$idAccount));

end have this error:

E_WARNING

class_parents() [function.class-parents]: object or string expected D:\Doctrine\ORM\Mapping\ClassMetadataFactory.php : 224

but when I fetch select('sr,a,p,s,t,tt') with this criteria all works fine. and when i use HYDRATE_ARRAY hydration all works fine too. But I need only t and tt fields, is there any way to do this??

+1  A: 

For object hydration you have to fetch the element set in FROM clause currently. There might even be an open bug/enhancement report for this.

beberlei