You are here

public function CSV::__construct in Migrate Source CSV 8

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

Constructs a \Drupal\Component\Plugin\PluginBase object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

Overrides SourcePluginBase::__construct

File

src/Plugin/migrate/source/CSV.php, line 46
Contains \Drupal\migrate_source_csv\Plugin\migrate\source\CSV.

Class

CSV
Source for CSV.

Namespace

Drupal\migrate_source_csv\Plugin\migrate\source

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $migration);

  // Path is required.
  if (empty($this->configuration['path'])) {
    throw new MigrateException('You must declare the "path" to the source CSV file in your source settings.');
  }

  // Key field(s) are required.
  if (empty($this->configuration['keys'])) {
    throw new MigrateException('You must declare "keys" as a unique array of fields in your source settings.');
  }
}