php - Join subquery with doctrine and Symfony 2 -
i saw begining of answer in post zend : join subquery doctrine 2 dbal unfortunately can't manage work. tried aimfeld soltuion that:
$qbaudio = $em->createquerybuilder(); $subselect = $qbaudio->select ('a.id_support id_support','sum(a.duration) dureetotale','count(a) nbaudio') ->from('mybundle:audioobject','a') ->groupby('a.id_support') ->where('a.type = :audio_type') ->getquery(); $qb = $em->createquerybuilder(); $qb->select('sp.ref1','sp.title1','count(i) nbimage','sp.nbsupportsaisi','sum(a.duration) dureetotale','count(a) nbaudio','a.sampling') ->from('mybundle:storage', 'st') ->leftjoin('p.sides','si') ->leftjoin('si.support','sp') ->leftjoin('sp.images','i') ->leftjoin('sp.audioobjects', sprintf('(%s)',$subselect->getdql()), 'a', 'on sp.id = a.id_support') ->groupby('sp.id') ->setparameter('audio_type', 'mp3')
unfortunately got message :
error: expected end of string, got 'select'
if it's possible zend, why not symfony? idea? thanks
use sql instead of dql:
$subselect->getsql()
Comments
Post a Comment