/**
  * Runs the batch update process
  */
 public function execute()
 {
     foreach ($this->reader as $rows) {
         $updates = [];
         foreach ($rows as $row) {
             $update = $this->generator->update($row);
             if ($update) {
                 $updates[] = ['primaryKey' => $this->reader->extractPrimaryKeys($row), 'changes' => $update];
             }
         }
         if ($updates) {
             $this->output("Processing " . count($updates) . " rows\n");
             $this->writer->write($updates);
         }
     }
     $this->output("Completed\n");
 }
 /**
  * @dataProvider provider_readerGetPrimaryKey
  */
 public function testReaderGetPrimaryKey($message, array $expected, array $row)
 {
     $reader = new BatchRowIterator($this->mockDb(), 'some_table', array_keys($expected), 8675309);
     $this->assertEquals($expected, $reader->extractPrimaryKeys((object) $row), $message);
 }