You are here

public function CSV::initializeIterator in Migrate Source CSV 8.2

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

Initializes the iterator with the source data.

Return value

\Iterator Returns an iteratable object of data for this source.

Overrides SourcePluginBase::initializeIterator

2 calls to CSV::initializeIterator()
CSV::fields in src/Plugin/migrate/source/CSV.php
Returns available fields on the source.
YieldRows::initializeIterator in tests/modules/source_plugin_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/source_plugin_yield_test/src/Plugin/migrate/source/YieldRows.php
Initializes the iterator with the source data.

File

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

Class

CSV
Source for CSV.

Namespace

Drupal\migrate_source_csv\Plugin\migrate\source

Code

public function initializeIterator() {
  if (!file_exists($this
    ->getConfiguration()['path'])) {
    throw new InvalidPluginDefinitionException($this
      ->getPluginId(), sprintf('File path (%s) does not exist.', $this
      ->getConfiguration()['path']));
  }

  // File handler using header-rows-respecting extension of SPLFileObject.
  $this->file = new $this->fileClass($this
    ->getConfiguration()['path']);
  return $this
    ->setupFile();
}