src/Pagamento/Repository.php
public function sumValor()
    {
        $tableGateway = new TableGateway($this->tableName, $this->dbAdapter);
        $sql = $tableGateway->getSql();
        $select = $sql->select()->columns(array('sum' => new Expression('SUM(valor)')));
        return $tableGateway->selectWith($select)->current();
    }
public function sumValor()
    {
        $tableGateway = new TableGateway($this->tableName, $this->dbAdapter);
        $sql = $tableGateway->getSql();
        $select = $sql->select()->columns(array('sum' => new Expression('SUM(valor)')));
        return $tableGateway->selectWith($select)->current();
    }
Encontra  somados valores de todos os pagamentos no BD