Piwik\Archive::getDataTable PHP Method

getDataTable() public method

This method will query blob data that is a serialized array of of {@link DataTable\Row}'s and unserialize it. If multiple sites were requested in {@link build()} or {@link factory()} the result will be a {@link DataTable\Map} that is indexed by site ID. If multiple periods were requested in {@link build()} or {@link factory()} the result will be a DataTable\Map that is indexed by period. The site ID index is always first, so if multiple sites & periods were requested, the result will be a {@link DataTable\Map} indexed by site ID which contains {@link DataTable\Map} instances that are indexed by period.
public getDataTable ( string $name, integer | string | null $idSubtable = null ) : DataTable | Piwik\DataTable\Map
$name string The name of the record to get. This method can only query one record at a time.
$idSubtable integer | string | null The ID of the subtable to get (if any).
return DataTable | Piwik\DataTable\Map A DataTable if multiple sites and periods were not requested. An appropriately indexed {@link DataTable\Map} if otherwise.
    public function getDataTable($name, $idSubtable = null)
    {
        $data = $this->get($name, 'blob', $idSubtable);
        return $data->getDataTable($this->getResultIndices());
    }