You are here

public function CommerceMigrateExampleMigration::__construct in Commerce Migrate 7

General initialization of a Migration object.

Overrides Migration::__construct

4 calls to CommerceMigrateExampleMigration::__construct()
CommerceExampleOrderMigration::__construct in commerce_migrate_example/migrations/order.inc
General initialization of a Migration object.
CommerceExampleProductDisplayMigration::__construct in commerce_migrate_example/migrations/product_display.inc
General initialization of a Migration object.
CommerceExampleProductLineItemMigration::__construct in commerce_migrate_example/migrations/product_line_item.inc
General initialization of a Migration object.
CommerceExampleProductMigration::__construct in commerce_migrate_example/migrations/product.inc
General initialization of a Migration object.
4 methods override CommerceMigrateExampleMigration::__construct()
CommerceExampleOrderMigration::__construct in commerce_migrate_example/migrations/order.inc
General initialization of a Migration object.
CommerceExampleProductDisplayMigration::__construct in commerce_migrate_example/migrations/product_display.inc
General initialization of a Migration object.
CommerceExampleProductLineItemMigration::__construct in commerce_migrate_example/migrations/product_line_item.inc
General initialization of a Migration object.
CommerceExampleProductMigration::__construct in commerce_migrate_example/migrations/product.inc
General initialization of a Migration object.

File

commerce_migrate_example/migrations/abstractions/migration.inc, line 28
A simple base class that contains things common to all CommerceMigrateExample classes.

Class

CommerceMigrateExampleMigration
Class CommerceMigrateExampleMigration.

Code

public function __construct(array $arguments) {
  parent::__construct($arguments);
  $this->modulePath = drupal_get_path('module', 'commerce_migrate_example');
  $csv_file = $this->modulePath . '/files/' . static::FILE;
  $csv_columns = array();
  if (!file_exists($csv_file)) {
    throw new \Exception(t('The "@csv_file" CSV file does not exists.', array(
      '@csv_file' => $csv_file,
    )));
  }
  foreach (static::csvColumns() as $drupal_field => $csv_header) {
    $csv_columns[] = array(
      $drupal_field,
      $csv_header,
    );
  }

  // Create a MigrateSource object, which manages retrieving the input data.
  $this->source = new \MigrateSourceCSV($csv_file, $csv_columns);
}