tags:

views:

9

answers:

1

i wonder in doctrine 2, how do i check if the query returned any result. say if i use the following ...

getXXXResult(); // eg. $result = $em->createQuery('xxx')->getXXXResult()
findXXX(); // eg. $obj = $em->getRepository('xxx')->findXXX();

i wonder what other methods are there to query for data in doctrine and how i can check if

  • there are any rows returned
  • how many rows returned/affected
A: 

i found my answers in Doctrine Google Groups

how about executing count() on the array result?

You can use a method of the Collection Array ... e.g.: $users->count();

jiewmeng