PHP Class Piwik\DataTable\Filter\ReplaceColumnNames
If no mapping is provided, this column will use one that maps index metric names
(which are integers) with their string column names. In the database, reports are
stored with integer metric names because it results in blobs that take up less space.
When loading the reports, the column names must be replaced, which is handled by this
class. (See {@link Piwik\Metrics} for more information about integer metric names.)
**Basic example**
filter use in a plugin's API method
public function getMyReport($idSite, $period, $date, $segment = false, $expanded = false)
{
$dataTable = Archive::createDataTableFromArchive('MyPlugin_MyReport', $idSite, $period, $date, $segment, $expanded);
$dataTable->queueFilter('ReplaceColumnNames');
return $dataTable;
}
Show file
Open project: piwik/piwik
Protected Properties
Public Methods
Method |
Description |
|
__construct ( DataTable $table, array | null $mappingToApply = null ) |
Constructor. |
|
filter ( DataTable $table ) |
See {@link ReplaceColumnNames}. |
|
Protected Methods
Method Details
__construct()
public method
public __construct ( DataTable $table, array | null $mappingToApply = null ) |
$table |
Piwik\DataTable |
The table that will be eventually filtered. |
$mappingToApply |
array | null |
The name mapping to apply. Must map old column names
with new ones, eg,
array('OLD_COLUMN_NAME' => 'NEW_COLUMN NAME',
'OLD_COLUMN_NAME2' => 'NEW_COLUMN NAME2')
If null, {@link Piwik\Metrics::$mappingFromIdToName} is used. |
See {@link ReplaceColumnNames}.
public filter ( DataTable $table ) |
$table |
Piwik\DataTable |
|
filterSimple()
protected method
protected filterSimple ( Piwik\DataTable\Simple $table ) |
$table |
Piwik\DataTable\Simple |
|
filterTable()
protected method
protected filterTable ( DataTable $table ) |
$table |
Piwik\DataTable |
|
flattenGoalColumns()
protected method
getRenamedColumn()
protected method
getRenamedColumns()
protected method
Checks the given columns and renames them if required
Property Details
$mappingToApply protected property
protected $mappingToApply |