/** * Returns the number of objects in the result * * @return integer The number of matching objects * @api */ public function count() { if ($this->numberOfResults === null) { if (is_array($this->queryResult)) { $this->numberOfResults = count($this->queryResult); } else { $this->numberOfResults = $this->persistenceManager->getObjectCountByQuery($this->query); } } return $this->numberOfResults; }