[TYPO3-mvc] Count query results

Stefan Isak stefanisak at googlemail.com
Tue May 18 11:04:04 CEST 2010


Hey,

got a question on counting rows of a query.
What is the best approach to get the number of results for a query having
constraints?

This is my query:
  $query = $this->createQuery();
  $constraints = array();
  $constraints[] = $query->equals(...);
  $constraints[] = $query->equals(...);
  $query->matching($query->logicalAnd($constraints))->execute();

What I tried was
  $query->matching($query->logicalAnd($constraints))->count();

Although the result is a number, it is a wrong one.

Any suggestions on that?

Thanks a lot.
Stefan


More information about the TYPO3-project-typo3v4mvc mailing list