Group By day and month Doctrine Group By day and month Doctrine symfony symfony

Group By day and month Doctrine


You haven't set an alias for your values. Here is an updated version :

   $result = $em->getRepository("AcmeApplicationBundle:SecurityServiceUser")        ->createQueryBuilder('user')        ->select(' user.username, MONTH(user.birthDate) AS gBmonth, DAY(user.birthDate) AS gBday')        ->where('user.birthDate IS NOT NULL')        ->groupBy('gBmonth')        ->addGroupBy('gBday')        ->getQuery()        ->getResult(); 

This should work fine.