added confirmation email for eshop
This commit is contained in:
@@ -135,5 +135,26 @@ class Helper {
|
||||
$controller->layout()->setTemplate("VueViews/Vue");
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an array of objects to a CSV file.
|
||||
* @param array $rows The array of objects to convert to CSV.
|
||||
* @return string The CSV file content.
|
||||
*/
|
||||
public static function arrayToCsv(array $rows): string {
|
||||
$output = fopen('php://temp', 'w');
|
||||
|
||||
// Add headers
|
||||
fputcsv($output, array_keys((array) $rows[0]));
|
||||
|
||||
// Add rows
|
||||
foreach ($rows as $row) {
|
||||
fputcsv($output, (array) $row);
|
||||
}
|
||||
|
||||
rewind($output);
|
||||
$csv = stream_get_contents($output);
|
||||
fclose($output);
|
||||
|
||||
return $csv;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user