In my table "Artiste" there is one column "valideAdmin" which takes the value 1 or 0.
I am trying to do a simple count to return the number of records in my table, where "valideAdmin" is 1:
$repo = $this ->getDoctrine()
->getManager()
->getRepository('ProjectMainBundle:Artiste');
$qb = $repo->createQueryBuilder('valideAdmin');
$qb->select('COUNT(valideAdmin)');
$qb->where('valideAdmin=1');
$count = $qb->getQuery()->getSingleScalarResult();
return array(
'count' => $count
);
But it is always "1" that come back ...
Without the where clause, I have the total number of table entries, but valideAdmin can be 0 or 1. I only need the number count, where valideAdmin = 1
thanks for the help
source
share