Reputation: 1676
I want to use orderby ASC with field name in this query :-
$repository = $this->em->getRepository('XXXAbcBundle:BuilderPage');
return $repository->findAll(\Doctrine\ORM\Query::HYDRATE_ARRAY);
How It's possible ?
I want the result set is hydrated into an array that represents the object graph in ASC order.
Upvotes: 1
Views: 5374
Reputation: 2379
If you need HYDRATE_ARRAY as an result then you can try this (this sort by BuilderPage.name ASC):
$repository = $this->em->getRepository('XXXAbcBundle:BuilderPage');
$query = $repository->createQueryBuilder('BuilderPage')
->select('BuilderPage')
->orderBy('BuilderPage.name', 'ASC')
->getQuery();
return $query->getResult(\Doctrine\ORM\Query::HYDRATE_ARRAY);
Upvotes: 1