Reputation: 6207
for example, I have this:
$this->createQueryBuilder('x')->select()->join('x.coupons', 'c')->getQuery()->getResult()
there are user
-s and their coupon
-s. This do joins the coupons
table but wont select its fields. If I refer to ->getCoupons()
, it will make an other select. Is there any workaround for this?
Upvotes: 0
Views: 26
Reputation: 3822
Change your query builder to this:
$this->createQueryBuilder('x')
->select('x', 'c')
->join('x.coupons', 'c')
->getQuery()
->getResult()
Upvotes: 1