With doctrine 2.4 you can use the `NEW` operator with the DQL query. 
http://doctrine-orm.readthedocs.org/en/latest/reference/dql-doctrine-query-language.html#new-operator-syntax

I dont have any problem creating the DTO from the query. I am getting the 
correct object.

My problem is I want to sort the results by their frequency. Is it possible?

Here is my code


$query = $this->em
   ->createQuery(
      'SELECT NEW'
      . ' \Elite\Inquiry\Application\ReadModel\CourseFrequency('
         . 'line.code,'
         . 'line.title,'
         . 'count(line.title)'
      . ')'
      . ' FROM Inquiry:InquiryLine line'
      . ' WHERE line.createdAt BETWEEN :from AND :to'
      . ' GROUP BY line.title'
   );

$query->setParameter('from', $this->from);
$query->setParameter('to', $this->to);
$query->setMaxResults($this->top);


-- 
You received this message because you are subscribed to the Google Groups 
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to