Skip to content

Cannot use object of type stdClass as array #11

@Devin0231577

Description

@Devin0231577

On line 207 of Analytics.php you have
$cols[] = $col['label'];

So I had to rewrite the function as

public function parseResult($results) {
        $simpleDataTable = $results->getDataTable()->toSimpleObject();
        foreach ($simpleDataTable->cols as $col) {
            $cols[] = $col->label;
        }
        foreach ($simpleDataTable->rows as $row) {
            foreach ($row->c as $key => $value) {
                $rowData[$cols[$key]] = $value->v;
            }

            $rows[] = $rowData;

            unset($rowData);
        }
        return [
            'cols' => $cols,
            'rows' => $rows,
        ];
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions