ManaPHP\Mvc\Model\QueryBuilder::_getTotalRows PHP Метод

_getTotalRows() защищенный Метод

protected _getTotalRows ( ) : integer
Результат integer
    protected function _getTotalRows()
    {
        if (count($this->_union) !== 0) {
            throw new QueryBuilderException('Union query is not support to get total rows');
        }
        $this->_columns = 'COUNT(*) as [row_count]';
        $this->_limit = 0;
        $this->_offset = 0;
        $this->_sql = $this->_buildSql();
        try {
            if ($this->_group === null) {
                $result = $this->modelsManager->getReadConnection(end($this->_models))->fetchOne($this->_sql, $this->_bind);
                /** @noinspection CallableParameterUseCaseInTypeContextInspection */
                $rowCount = (int) $result['row_count'];
            } else {
                $result = $this->modelsManager->getReadConnection(end($this->_models))->fetchAll($this->_sql, $this->_bind);
                $rowCount = count($result);
            }
        } catch (\Exception $e) {
            throw new QueryBuilderException(':message : :sql', ['message' => $e->getMessage(), 'sql' => $this->_sql]);
        }
        return $rowCount;
    }