Reputation: 6197
I want to get all images of a person and order by sequentally. I have this:
person entity:
return $this->createQueryBuilder('p')
->leftJoin('p.personImages','c')
->orderBy('c.sequence', 'asc')
->getQuery()
->getResult();
orderBy() has no effect, not even asc|desc. But if I misstype this field, it dies.
Upvotes: 1
Views: 384
Reputation: 4880
youve not 'selected' anything from the right hand table. Because of this c.sequence
will be null.
try this:
return $this->createQueryBuilder('p')
->select('p')
->leftJoin('p.personImages','c')
->addSelect('c')
->orderBy('c.sequence', 'asc')
->getQuery()
->getResult();
Upvotes: 1