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

Whereas {@link make()} creates a Map for each result index (period and|or site), this will only create a Map for a period result index and move all site related indices into one dataTable. This is the same as doing $dataTableFactory->make()->mergeChildren() just much faster. It is mainly useful for reports across many sites eg MultiSites.getAll. Was done as part of https://github.com/piwik/piwik/issues/6809
public makeMerged ( 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
 /**
  * @expectedException \Exception
  * @expectedExceptionMessage supposed to work with non-numeric data types but it is not tested
  */
 public function test_makeMerged_shouldThrowAnException_IfANonNumericDataTypeIsGiven()
 {
     $dataType = 'blob';
     $dataNames = array('nb_visits');
     $factory = new DataTableFactory($dataNames, $dataType, array($this->site1), $periods = array(), $this->defaultRow);
     $factory->makeMerged(array(), array());
 }
Пример #2
0
 /**
  * See {@link DataTableFactory::makeMerged()}
  *
  * @param array $resultIndices
  * @return DataTable|DataTable\Map
  * @throws Exception
  */
 public function getMergedDataTable($resultIndices)
 {
     $dataTableFactory = new DataTableFactory($this->dataNames, $this->dataType, $this->sitesId, $this->periods, $this->defaultRow);
     $index = $this->getIndexedArray($resultIndices);
     return $dataTableFactory->makeMerged($index, $resultIndices);
 }