protected function GdprTasksSarWorker::writeCsv in General Data Protection Regulation 8
Same name and namespace in other branches
- 8.2 modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php \Drupal\gdpr_tasks\Plugin\QueueWorker\GdprTasksSarWorker::writeCsv()
- 3.0.x modules/gdpr_tasks/src/Plugin/QueueWorker/GdprTasksSarWorker.php \Drupal\gdpr_tasks\Plugin\QueueWorker\GdprTasksSarWorker::writeCsv()
Write data to a CSV file.
@todo: Use something like this instead: \Consolidation\OutputFormatters\Formatters\CsvFormatter
Parameters
string $filename: The filename to write to (supports streams).
array $content: The data to write, an array containing each row as an array.
1 call to GdprTasksSarWorker::writeCsv()
- GdprTasksSarWorker::build in modules/
gdpr_tasks/ src/ Plugin/ QueueWorker/ GdprTasksSarWorker.php - Build the export files.
File
- modules/
gdpr_tasks/ src/ Plugin/ QueueWorker/ GdprTasksSarWorker.php, line 435
Class
- GdprTasksSarWorker
- Processes SARs tasks when data processing is required.
Namespace
Drupal\gdpr_tasks\Plugin\QueueWorkerCode
protected function writeCsv($filename, array $content) {
$handler = fopen($filename, 'w');
// Write the UTF-8 BOM header so excel handles the encoding.
fprintf($handler, chr(0xef) . chr(0xbb) . chr(0xbf));
foreach ($content as $row) {
fputcsv($handler, $row);
}
fclose($handler);
}