Skip to content

dynamically add new Entry to row #3

Answered by norberttech
azngeek asked this question in Questions
Discussion options

You must be logged in to vote

Oh I see, so here are a few examples of how you can achieve it.
You were almost good, but you need to remember that Rows is immutable, which means that while iterating using foreach even if you change something at a single Row it wont affect Rows.
To adjust Rows you should use Rows::map(static fn (Row $row) : Row => $row) that will return a new instance of Rows that would include your changes at each Row you made through the anonymous function.

<?php

use Flow\ETL\DSL\Entry;
use Flow\ETL\DSL\From;
use Flow\ETL\DSL\To;
use Flow\ETL\DSL\Transform;
use Flow\ETL\Flow;
use Flow\ETL\Memory\ArrayMemory;
use Flow\ETL\Row;
use Flow\ETL\Rows;
use Flow\ETL\Transformer;

require __DIR__ . '/../vendor…

Replies: 0 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by norberttech
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants