You are here

public function WineVarietyUpdatesMigration::__construct in Migrate 6.2

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

General initialization of a Migration object.

Overrides AdvancedExampleMigration::__construct

File

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

Class

WineVarietyUpdatesMigration

Code

public function __construct() {
  parent::__construct();
  $this->description = t('Migrate varieties from the source database to taxonomy terms');
  $this->dependencies = array(
    'WineVariety',
  );
  $this->softDependencies = array(
    'WineUpdates',
  );
  $this->map = new MigrateSQLMap($this->machineName, array(
    'categoryid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ),
  ), MigrateDestinationTerm::getKeySchema());
  $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->systemOfRecord = Migration::DESTINATION;

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

  // Unmapped source fields
  // Unmapped destination fields
  $this
    ->addFieldMapping('name');
  $this
    ->addFieldMapping('parent');
  $this
    ->addFieldMapping('weight');
  $this
    ->addFieldMapping('format');
  $this
    ->addFieldMapping('parent_name')
    ->issueGroup(t('DNM'));
}