You are here

public function CSV::initializeIterator in Migrate Source CSV 8.3

Same name and namespace in other branches
  1. 8 src/Plugin/migrate/source/CSV.php \Drupal\migrate_source_csv\Plugin\migrate\source\CSV::initializeIterator()
  2. 8.2 src/Plugin/migrate/source/CSV.php \Drupal\migrate_source_csv\Plugin\migrate\source\CSV::initializeIterator()

Throws

\Drupal\migrate\MigrateException

\League\Csv\Exception

Overrides SourcePluginBase::initializeIterator

1 call to CSV::initializeIterator()
YieldRows::initializeIterator in tests/modules/csv_source_yield_test/src/Plugin/migrate/source/YieldRows.php
Initializes the iterator with the source data.
1 method overrides CSV::initializeIterator()
YieldRows::initializeIterator in tests/modules/csv_source_yield_test/src/Plugin/migrate/source/YieldRows.php
Initializes the iterator with the source data.

File

src/Plugin/migrate/source/CSV.php, line 192

Class

CSV
Source for CSV files.

Namespace

Drupal\migrate_source_csv\Plugin\migrate\source

Code

public function initializeIterator() {
  $header = $this
    ->getReader()
    ->getHeader();
  if ($this->configuration['fields']) {

    // If there is no header record, we need to flip description and name so
    // the name becomes the header record.
    $header = array_flip($this
      ->fields());
  }
  return $this
    ->getGenerator($this
    ->getReader()
    ->getRecords($header));
}