You are here

protected function GoogleSheets::fetchNextRow in Migrate Google Sheets 2.x

Same name and namespace in other branches
  1. 8 src/Plugin/migrate_plus/data_parser/GoogleSheets.php \Drupal\migrate_google_sheets\Plugin\migrate_plus\data_parser\GoogleSheets::fetchNextRow()

File

src/Plugin/migrate_plus/data_parser/GoogleSheets.php, line 75

Class

GoogleSheets
Obtain Google Sheet data for migration.

Namespace

Drupal\migrate_google_sheets\Plugin\migrate_plus\data_parser

Code

protected function fetchNextRow() {
  $current = $this->iterator
    ->current();
  if ($current) {
    foreach ($this
      ->fieldSelectors() as $field_name => $selector) {

      // Actual values are stored in c[<column index>]['v'].
      $column_index = array_search(strtolower($selector), $this->headers);
      if ($column_index >= 0) {
        $this->currentItem[$field_name] = $current['c'][$column_index]['v'];
      }
      else {
        $this->currentItem[$field_name] = NULL;
      }
    }
    $this->iterator
      ->next();
  }
}