public __construct ( |
||
$table | The DataTable instance that will eventually be filtered. | |
$columnsToRemove | array | string | An array of column names or a comma-separated list of column names. These columns will be removed. |
$columnsToKeep | array | string | An array of column names that should be kept or a comma-separated list of column names. Columns not in this list will be removed. |
$deleteIfZeroOnly | boolean | If true, columns will be removed only if their value is 0. |
public function __construct($table, $columnsToRemove, $columnsToKeep = array(), $deleteIfZeroOnly = false)
{
parent::__construct($table);
if (is_string($columnsToRemove)) {
$columnsToRemove = $columnsToRemove == '' ? array() : explode(',', $columnsToRemove);
}
if (is_string($columnsToKeep)) {
$columnsToKeep = $columnsToKeep == '' ? array() : explode(',', $columnsToKeep);
}
$this->columnsToRemove = $columnsToRemove;
$this->columnsToKeep = array_flip($columnsToKeep);
// flip so we can use isset instead of in_array
$this->deleteIfZeroOnly = $deleteIfZeroOnly;
}