0

i m using Zendframework2 and using count function to count the number of values, it fails when i try to count the integer values

$q = $dm->createQueryBuilder('Admin\Document\Institution')
    ->field('id')->notEqual($id)
    ->field('coreid')->equals($post['coreid']);
    $coreid = $q->getQuery()->execute()->count();

does count function works for integer valeues in Doctrine2 ODM?

Shahbaz
  • 3,433
  • 1
  • 26
  • 43
  • I'm not sure I understand what your issue is. Can you elaborate on what you mean by "does count function works for integer values"? – AlexP Oct 11 '13 at 22:09
  • i mean to say that if i use count function with string values it returns how many times string entered but if I use it with integer values it returns 0 every time. – Shahbaz Oct 14 '13 at 06:21

1 Answers1

0

If you change your query slightly then possibly get your count value.

$q = $dm->createQueryBuilder('Admin\Document\Institution')
        ->select('count(id) as id')
        ->where('id !=:id AND coreid != :coreid')
        ->setParameters(array('id'=> $id,'coreid'=>$coreid);

$coreid = $q->getQuery()->execute();
Md Mehedi Hasan
  • 1,733
  • 1
  • 21
  • 34