OK, so getting back to this. I still find the exported columns are in a different order than what I set them to . Below is a screen grab of the report:
Here is a screen grab of the excel spreadsheet:
Here is the column data from the Table::Create:
array (
'Attendee' => array('label' => 'Attendee', 'cssStyle' => array('td' => 'padding-top:4px;padding-bottom:4px;',), ),
'Guest(s)' => array('label' => 'Guest(s)', 'cssStyle' => array('td' => 'padding-top:4px;padding-bottom:4px;',), ),
'Meal Choice' => array('label' => 'Meal Choice', 'cssStyle' => array('td' => 'padding-top:4px;padding-bottom:4px;',), ),
'Extras' => array('label' => 'Extras', 'cssStyle' => array('td' => 'padding-top:4px;padding-bottom:4px;',), ),
'Column 1' => array('label' => 'Column 1', 'cssStyle' => array('td' => 'padding-top:4px;padding-bottom:4px;',), ),
'Column 2' => array('label' => 'Column 2', 'cssStyle' => array('td' => 'padding-top:4px;padding-bottom:4px;',), ),
)
and here is the meta data from the meta pipe:
"columns" => Array (
"Attendee" => Array ( "type" => string ),
"Guest(s)" => Array ( "type" => string ),
"Meal Choice" => Array ( "type" => string ),
"Extras" => Array ( "type" => string ),
"Column 1" => Array ( "type" => string ),
"Column 2" => Array ( "type" => string )
)
);
and finally the code use to generate the meta:
$source->pipe(new \koolreport\processes\Map(array(
'{meta}' => function($meta) {
$newMeta = ['columns' => []];
/* First are the Attendee & guest fields */
$newMeta['columns']['Attendee'] = $meta['columns']['Attendee'];
if (array_key_exists('Guest(s)', $meta['columns'])) {
$newMeta['columns']['Guest(s)'] = $meta['columns']['Guest(s)'];
}
/* Now the template fields */
foreach($this->selectedOptions as $selectedOption) {
$title = $this->selectedOptionDetails[$selectedOption]['title'];
if (array_key_exists($title, $meta['columns'])) {
$newMeta['columns'][$title] = $meta['columns'][$title];
}
}
/* And now the extra fields */
foreach($this->additionalColumns as $additionalColumn) {
if (array_key_exists($additionalColumn, $meta['columns'])) {
$newMeta['columns'][$additionalColumn] = $meta['columns'][$additionalColumn];
}
}
return $newMeta;
},
)));
Somethings wrong but I know not what. Looking for help, thanks.