I have a DQL query likes this:
$dql = "SELECT p, count(u.id) as ucnt FROM IAA\Entity\Project p " .
"JOIN p.likedByUsers u ORDER BY ucnt";
$query = $this->_em->createQuery($dql);
Question is, how can I hold on to sorting by count, but NOT get them in result? I want to get only projects sorted by count, not array with [project] and [ucnt].
Starting from Doctrine 2.2 (source) :
SELECT a, COUNT(b.id) AS HIDDEN c [...] ORDER BY c
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With