CrudKit\Data\SQLDataProvider::getRowCount PHP Method

getRowCount() public method

public getRowCount ( array $params = [] )
$params array
    public function getRowCount(array $params = [])
    {
        $builder = $this->conn->createQueryBuilder();
        $builder->select(array("COUNT(" . $this->getPrimaryColumn()->getExpr() . ") AS row_count"))->from($this->tableName);
        if (isset($params['filters_json'])) {
            $filters = json_decode($params['filters_json'], true);
            if (count($filters) > 0) {
                $this->addConditionsToBuilder($builder, $filters);
            }
        }
        LoggingHelper::logBuilder($builder);
        $exec = $builder->execute();
        $countResult = $exec->fetchAll(\PDO::FETCH_ASSOC);
        return $countResult[0]['row_count'];
    }