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 | Type | Description |
|---|---|---|
| $name | mixed |
mixed
|
| $outputName | mixed |
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 | Type | Description |
|---|---|---|
| $columns | mixed |
mixed
|
| $options | mixed |
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 | Type | Description |
|---|---|---|
| $columns | mixed |
mixed
|
| $sessionKey | mixed |
mixed
|
Returns
mixed
protected
encodeArrayValue ($data, string $delimeter = "|")
: string
Implodes a single dimension array using pipes (|) Multi dimensional arrays are not allowed.
Parameters
| Property | Type | Description |
|---|---|---|
| $data | mixed |
mixed
|
| $delimeter | string |
string
|
Returns
string
protected exportExtendColumns ($columns)
Used to override column definitions at export time.
Parameters
| Property | Type | Description |
|---|---|---|
| $columns | mixed |
mixed
|
Returns
mixed
protected getColumnHeaders ($columns)
Extracts the headers from the column definitions.
Parameters
| Property | Type | Description |
|---|---|---|
| $columns | mixed |
mixed
|
Returns
mixed
protected matchDataToColumns ($data, $columns)
Ensures the correct order of the column data.
Parameters
| Property | Type | Description |
|---|---|---|
| $data | mixed |
mixed
|
| $columns | mixed |
mixed
|
Returns
mixed
protected processExportData ($columns, $results, $options)
Converts a data collection to a CSV file.
Parameters
| Property | Type | Description |
|---|---|---|
| $columns | mixed |
mixed
|
| $results | mixed |
mixed
|
| $options | mixed |
mixed
|
Returns
mixed
Copyright © 2025 Winter CMS