I need to limit the results of the LEFT JOIN, so I have to use a subquery. Can someone give me some advice on how I can do this with Doctrine 2?
Now I have:
$qb = $this->_em->createQueryBuilder();
return $qb->add('select', 'c,j')
->add('from', 'JobeetBundle:Category c')
->leftJoin('c.jobs', 'j', 'WITH', 'j.category = c')
->add('where', 'j.expiresAt > ?1')
->add('orderBy','j.expiresAt DESC')
->setParameter(1, new \DateTime())
->getQuery()
->getResult();
but I have to change it to limit the results of assignments to 10 for each category.
source
share