80 $this->
output =
function ( $text ) {
88 foreach ( $this->reader as $rows ) {
90 foreach ( $rows as $row ) {
91 $update = $this->generator->update( $row );
94 'primaryKey' => $this->reader->extractPrimaryKeys( $row ),
101 $this->
output(
"Processing " . count( $updates ) .
" rows\n" );
102 $this->writer->write( $updates );
106 $this->
output(
"Completed\n" );
126 call_user_func( $this->
output, $text );
Allows iterating a large number of rows in batches transparently.
callable $output
Output callback.
setOutput(callable $output)
Accepts a callable which will receive a single parameter containing string status updates.
__construct(BatchRowIterator $reader, BatchRowWriter $writer, RowUpdateGenerator $generator)
execute()
Runs the batch update process.
BatchRowWriter $writer
Writer capable of pushing row updates to the database.
RowUpdateGenerator $generator
Generates single row updates based on the rows content.
BatchRowIterator $reader
Iterator that returns an array of database rows.
output( $text)
Write out a status update.