You are here

public function WineVarietyUpdatesMigration::__construct in Migrate 7.2

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

General initialization of a Migration object.

Overrides AdvancedExampleMigration::__construct

File

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

Class

WineVarietyUpdatesMigration

Code

public function __construct($arguments) {
  parent::__construct($arguments);
  $this->description = t('Migrate varieties from the source database to taxonomy terms');
  $query = db_select('migrate_example_wine_variety_updates', 'wc')
    ->fields('wc', array(
    'categoryid',
    'details',
  ));
  $this->source = new MigrateSourceSQL($query);
  $this->destination = new MigrateDestinationTerm('migrate_example_wine_varieties');
  $this->map = new MigrateSQLMap($this->machineName, array(
    'categoryid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ),
  ), MigrateDestinationTerm::getKeySchema());
  $this->systemOfRecord = Migration::DESTINATION;

  // Mapped fields
  $this
    ->addFieldMapping('tid', 'categoryid')
    ->sourceMigration('WineVariety');
  $this
    ->addFieldMapping('description', 'details');

  // Unmapped source fields
  // Unmapped destination fields
  $this
    ->addUnmigratedDestinations(array(
    'format',
    'name',
    'parent',
    'parent_name',
    'weight',
  ));
}