Piwik\DataTable::getEmptyClone PHP Method

getEmptyClone() public method

Returns an empty DataTable with the same metadata and queued filters as $this one.
public getEmptyClone ( boolean $keepFilters = true ) : DataTable
$keepFilters boolean Whether to pass the queued filter list to the new DataTable or not.
return DataTable
    public function getEmptyClone($keepFilters = true)
    {
        $clone = new DataTable();
        if ($keepFilters) {
            $clone->queuedFilters = $this->queuedFilters;
        }
        $clone->metadata = $this->metadata;
        return $clone;
    }

Usage Example

Beispiel #1
0
 /**
  * Template method called from self::manipulate.
  * Flatten each data table.
  *
  * @param DataTable $dataTable
  * @return DataTable
  */
 protected function manipulateDataTable($dataTable)
 {
     $newDataTable = $dataTable->getEmptyClone($keepFilters = true);
     // this recursive filter will be applied to subtables
     $dataTable->filter('ReplaceSummaryRowLabel');
     $this->flattenDataTableInto($dataTable, $newDataTable);
     return $newDataTable;
 }
All Usage Examples Of Piwik\DataTable::getEmptyClone