Skip to content

Count with Group by fails  #502

Open
@ghost

Description

I have the following query:

$qb = $em->createQueryBuilder();
$qb->select('de', 'COUNT(de.auftragsnummer) as menge');
$qb->from('App\Entity\DispositionsplanEintrag', 'de');
$qb->where('de.geloescht IS NULL');
$qb->groupBy('de.auftragsnummer');
$qb->orderBy('de.auftragsnummer', 'ASC');

Executed by the following code:

$query = $qb->getQuery();
$paginator = $this->get('knp_paginator');
$eintraege = $paginator->paginate($query, $request->query->getInt('page', 1), 20);

it results in having the variable "menge" always has the value 1.
if I execute $eintraege = $query->getResult(); then the value of "menge" is correct.
Is there anything wrong in my example, or is it a bug?

Thank you!

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions