You are here

public function CommerceKickstartCollection::__construct in Commerce Kickstart 7.2

General initialization of a Migration object.

Overrides Migration::__construct

File

modules/commerce_kickstart/commerce_kickstart_product/commerce_kickstart_product.migrate.inc, line 695
Migrations for commerce_kickstart_product.

Class

CommerceKickstartCollection
Class CommerceKickstartCollection.

Code

public function __construct($arguments) {
  parent::__construct($arguments);
  $this->description = t('Import collections terms.');

  // Create a map object for tracking the relationships between source rows.
  $this->map = new MigrateSQLMap($this->machineName, array(
    'name' => array(
      'type' => 'varchar',
      'length' => 255,
      'not null' => TRUE,
    ),
  ), MigrateDestinationTerm::getKeySchema());

  // Create a MigrateSource object.
  $this->source = new MigrateSourceCSV(drupal_get_path('module', 'commerce_kickstart_product') . '/import/collections.csv', $this
    ->csvcolumns(), array(
    'header_rows' => 1,
  ));
  $this->destination = new MigrateDestinationTerm('collection');
  $this
    ->addFieldMapping('name', 'name');

  // Images.
  $this
    ->addFieldMapping('field_image', 'images');
  $this
    ->addFieldMapping('field_image:file_replace')
    ->defaultValue(FILE_EXISTS_REPLACE);
  $this
    ->addFieldMapping('field_image:source_dir')
    ->defaultValue(drupal_get_path('module', 'commerce_kickstart_product') . '/import/images');
}