ExportModel

Model used for exporting data

abstract class Backend\Models\ExportModel
extends Model

Extends

Class Description
Model

Methods

public download ($name, $outputName = null) : void

Download a previously compiled export file.

Parameters
Property Description
$name
mixed
$outputName
mixed
Returns
void

public export ($columns, $options)

Export data based on column names and labels.

The $columns array should be in the format of:

[ 'db_name1' => 'Column label', 'db_name2' => 'Another label', ... ]

Parameters
Property Description
$columns
mixed
$options
mixed
Returns
mixed

public exportData ($columns, $sessionKey = null)

Called when data is being exported.

The return value should be an array in the format of:

[ 'db_name1' => 'Some attribute value', 'db_name2' => 'Another attribute value' ], [...]

Parameters
Property Description
$columns
mixed
$sessionKey
mixed
Returns
mixed

protected encodeArrayValue ($data, string $delimeter = "|") : string

Implodes a single dimension array using pipes (|) Multi dimensional arrays are not allowed.

Parameters
Property Description
$data
mixed
$delimeter
string
Returns
string

protected exportExtendColumns ($columns)

Used to override column definitions at export time.

Parameters
Property Description
$columns
mixed
Returns
mixed

protected getColumnHeaders ($columns)

Extracts the headers from the column definitions.

Parameters
Property Description
$columns
mixed
Returns
mixed

protected matchDataToColumns ($data, $columns)

Ensures the correct order of the column data.

Parameters
Property Description
$data
mixed
$columns
mixed
Returns
mixed

protected processExportData ($columns, $results, $options)

Converts a data collection to a CSV file.

Parameters
Property Description
$columns
mixed
$results
mixed
$options
mixed
Returns
mixed
Copyright © 2024 Winter CMS