You are here

public function MerciItemMigration::__construct in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

General initialization of a Migration object.

Overrides Migration::__construct

File

merci_migrate/merci_items.inc, line 8

Class

MerciItemMigration

Code

public function __construct($arguments) {
  parent::__construct($arguments);
  $this->source = new MerciItemMigrateSource();

  // Entity type, and bundle.
  $this->destination = new MigrateDestinationCommerceProduct('commerce_product', 'merci_resource');
  $this->map = new MigrateSQLMap($this->machineName, array(
    'nid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ),
  ), MigrateDestinationEntityAPI::getKeySchema('commerce_product'));
  $this
    ->addFieldMapping('sku', 'title');
  $this
    ->addFieldMapping('title', 'title');
  $this
    ->addFieldMapping('field_part_description', 'body');
  $this
    ->addFieldMapping('field_quantity')
    ->defaultValue(1);
  $this
    ->addFieldMapping('commerce_price')
    ->defaultValue(0);
  $this
    ->addFieldMapping('status', 'merci_default_availability');
}