make() публичный Метод

Creates a DataTable|Set instance using an index of archive data.
public make ( array $index, array $resultIndices ) : DataTable | Piwik\DataTable\Map
$index array @see DataCollection
$resultIndices array an array mapping metadata names with pretty metadata labels.
Результат Piwik\DataTable | Piwik\DataTable\Map
Пример #1
0
 /**
  * Returns archive data as a DataTable indexed by metadata. Indexed data will
  * be represented by Map instances. Each DataTable will have
  * its subtable IDs set.
  *
  * This function will only work if blob data was loaded and only one record
  * was loaded (not including subtables of the record).
  *
  * @param array $resultIndices An array mapping metadata names to pretty labels
  *                             for them. Each archive data row will be indexed
  *                             by the metadata specified here.
  *
  *                             Eg, array('site' => 'idSite', 'period' => 'Date')
  * @param int|null $idSubTable The subtable to return.
  * @param int|null $depth max depth for subtables.
  * @param bool $addMetadataSubTableId Whether to add the DB subtable ID as metadata
  *                                    to each datatable, or not.
  * @throws Exception
  * @return DataTable|DataTable\Map
  */
 public function getExpandedDataTable($resultIndices, $idSubTable = null, $depth = null, $addMetadataSubTableId = false)
 {
     if ($this->dataType != 'blob') {
         throw new Exception("DataCollection: cannot call getExpandedDataTable with " . "{$this->dataType} data types. Only works with blob data.");
     }
     if (count($this->dataNames) !== 1) {
         throw new Exception("DataCollection: cannot call getExpandedDataTable with " . "more than one record.");
     }
     $dataTableFactory = new DataTableFactory($this->dataNames, 'blob', $this->sitesId, $this->periods, $this->defaultRow);
     $dataTableFactory->expandDataTable($depth, $addMetadataSubTableId);
     $dataTableFactory->useSubtable($idSubTable);
     $index = $this->getIndexedArray($resultIndices);
     return $dataTableFactory->make($index, $resultIndices);
 }