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; }
Inheritance: extends Piwik\DataTable\BaseFilter
Show file Open project: piwik/piwik

Protected Properties

Property Type Description
$mappingToApply

Public Methods

Method Description
__construct ( DataTable $table, array | null $mappingToApply = null ) Constructor.
filter ( DataTable $table ) See {@link ReplaceColumnNames}.

Protected Methods

Method Description
filterSimple ( Piwik\DataTable\Simple $table )
filterTable ( DataTable $table )
flattenGoalColumns ( $columnValue ) : array
getRenamedColumn ( $column )
getRenamedColumns ( array $columns ) : array Checks the given columns and renames them if required

Method Details

__construct() public method

Constructor.
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.

filter() public method

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

protected flattenGoalColumns ( $columnValue ) : array
$columnValue
return array

getRenamedColumn() protected method

protected getRenamedColumn ( $column )

getRenamedColumns() protected method

Checks the given columns and renames them if required
protected getRenamedColumns ( array $columns ) : array
$columns array
return array

Property Details

$mappingToApply protected property

protected $mappingToApply