Write given array to a CSV file, will wait until the end of the previous iteration (this is a blocking task) and outputs the file path.
- Service:
CleverAge\ProcessBundle\Task\File\Csv\CsvWriterTask
- Blocking task
array
: foreach line, it will need a php array where key match the headers and values are convertible to string.
Underlying method is fputcsv.
string
: absolute path of the produced file
Code | Type | Required | Default | Description |
---|---|---|---|---|
file_path |
string |
X | Path of the file to write to (relative to symfony root or absolute). It can also take two placeholders ({date} and {date_time} ) to insert timestamps into the filename |
|
delimiter |
string |
; |
CSV delimiter | |
enclosure |
string |
" |
CSV enclosure character | |
escape |
string |
\\ |
CSV escape character | |
headers |
array or null |
null |
Static list of CSV headers, without the option, it will be dynamically read from first line | |
mode |
string |
wb |
File open mode (see fopen mode parameter) | |
split_character |
string |
| |
Used to implode array values | |
write_headers |
bool |
true |
Write the headers as a first line |