You are here

public function WineTableMigration::__construct in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 migrate_example/wine.inc \WineTableMigration::__construct()

General initialization of a Migration object.

Overrides AdvancedExampleMigration::__construct

File

migrate_example/wine.inc, line 1510
Advanced migration examples. These serve two purposes:

Class

WineTableMigration

Code

public function __construct($arguments) {
  parent::__construct($arguments);
  $this->description = 'Miscellaneous table data';
  $table_name = 'migrate_example_wine_table_dest';
  $query = db_select('migrate_example_wine_table_source', 't')
    ->fields('t', array(
    'fooid',
    'field1',
    'field2',
  ));
  $this->source = new MigrateSourceSQL($query);
  $this->destination = new MigrateDestinationTable($table_name);
  $this->map = new MigrateSQLMap($this->machineName, array(
    'fooid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ),
  ), MigrateDestinationTable::getKeySchema($table_name));

  // Mapped fields
  $this
    ->addFieldMapping('drupal_text', 'field1');
  $this
    ->addFieldMapping('drupal_int', 'field2');
  $this
    ->addUnmigratedDestinations(array(
    'recordid',
  ));
  $this
    ->removeFieldMapping('path');
  $this
    ->removeFieldMapping('pathauto');
}