public function aggregate($function, $fields = null) { $query = clone $this->_query; return $query->select(sprintf('%s(%s)', $function, $fields))->execute()->scalar(); }