Documentation
Building Blocks
Entries are the columns of the data frame, they are represented by the Entry interface.
Group of Entries is called Row
, it is represented by the Row class.
Group of Rows is called Rows
, it is represented by the Rows class.
Let's look at the following example:
<?php
declare(strict_types=1);
use function Flow\ETL\DSL\{bool_entry, int_entry, row, rows, str_entry};
$rows = rows(
row(int_entry('id', 1), str_entry('name', 'user_01'), bool_entry('active', true)),
row(int_entry('id', 2), str_entry('name', 'user_02'), bool_entry('active', false)),
row(int_entry('id', 3), str_entry('name', 'user_03'), bool_entry('active', true)),
row(int_entry('id', 3), str_entry('name', 'user_04'), bool_entry('active', false)),
);
Rows are the main data structure in Flow ETL, they’re used to represent data in the data frame. Extractors are yielding Rows and Loaders are saving Rows.
The same can be achieved using the following code:
<?php
declare(strict_types=1);
use function Flow\ETL\DSL\array_to_rows;
$rows = array_to_rows([
['id' => 1, 'name' => 'user_01', 'active' => true],
['id' => 2, 'name' => 'user_02', 'active' => false],
['id' => 3, 'name' => 'user_03', 'active' => true],
['id' => 4, 'name' => 'user_04', 'active' => false],
]);
Entry Types
Internally flow is using EntryFactory to create entries. It will try to detect and create the most appropriate entry type based on the value.
Flow Entries are based on PHP Types, which are divided into two groups:
- Native
- Array
- Callable
- Enum
- Object
- Resource
- Scalar
- Logical
- List
- Map
- Structure