Write datasets directly to an associative array. Please pay attention to the memory usage when using array loader. Large datasets may cause memory overflow.
Example: Array
Topic: Data writing
Description
Code
<?php
declare(strict_types=1);
use function Flow\ETL\DSL\{data_frame, from_array, to_array};
require __DIR__ . '/../../../autoload.php';
$array = [];
data_frame()
->read(from_array([
['id' => 1],
['id' => 2],
['id' => 3],
['id' => 4],
['id' => 5],
]))
->collect()
->write(to_array($array))
->run();
\file_put_contents(__DIR__ . '/output.txt', \var_export($array, true));
Output
array (
0 =>
array (
'id' => 1,
),
1 =>
array (
'id' => 2,
),
2 =>
array (
'id' => 3,
),
3 =>
array (
'id' => 4,
),
4 =>
array (
'id' => 5,
),
)