MassMailerExports extends MassMailerModel uses Parser
MassMailerExports model
Table of Contents
Properties
| $columns | |
| $file_open_mode | |
| $filename | |
| $job_id | |
| $writer |
Methods
| __construct() | Set exportable columns |
| addHeaders() | Adds a row of headers to the export using the preset columns |
| addRow() | Adds a row to the CSV export for the current job |
| getFilename() | Retrieves the filename of the saved export file |
| setColumns() | Sets the columns for the export |
| setJob() | Sets the job to use for this export |
| validateJobTask() | Validates that the given task belongs to the current job |
| createWriter() | Creates an instance of the CSV writer |
| getRules() | Retrieves a set of rules for validating adding a row |
| getTask() | Retrieves a mailing task row |
Methods
__construct()
Set exportable columns
public
__construct() : mixed
addHeaders()
Adds a row of headers to the export using the preset columns
public
addHeaders() : mixed
addRow()
Adds a row to the CSV export for the current job
public
addRow(int $task_id) : mixed
Parameters
- $task_id : int
-
The ID of the task representing the row to add to the export
getFilename()
Retrieves the filename of the saved export file
public
getFilename() : string
Return values
string —The filename
setColumns()
Sets the columns for the export
public
setColumns(array<string|int, mixed> $columns) : mixed
Parameters
- $columns : array<string|int, mixed>
-
A key/value array of columns where the key is the column name and the value is the value to use for the cell of each row in this column
setJob()
Sets the job to use for this export
public
setJob(int $job_id[, string $file_open_mode = 'w' ]) : mixed
Parameters
- $job_id : int
-
The ID of the job from which to create an export
- $file_open_mode : string = 'w'
-
The type of access to the file stream for this job (e.g. 'a' to append to an existing job file, 'w' to write a new job file; default 'w')
validateJobTask()
Validates that the given task belongs to the current job
public
validateJobTask(int $task_id) : bool
Parameters
- $task_id : int
-
The ID of the task
Return values
bool —True if the task belongs to the current job, otherwise false
createWriter()
Creates an instance of the CSV writer
private
createWriter() : mixed
getRules()
Retrieves a set of rules for validating adding a row
private
getRules() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of Input rules
getTask()
Retrieves a mailing task row
private
getTask(int $task_id) : mixed
Parameters
- $task_id : int
-
The ID of the task to fetch
Return values
mixed —An stdClass object representing the task, otherwise false