You are here

public function WineUserUpdatesMigration::__construct in Migrate 7.2

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

General initialization of a Migration object.

Overrides AdvancedExampleMigration::__construct

File

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

Class

WineUserUpdatesMigration

Code

public function __construct($arguments) {
  parent::__construct($arguments);
  $this->description = t('Account updates');
  $query = db_select('migrate_example_wine_account_updates', 'wa')
    ->fields('wa', array(
    'accountid',
    'sex',
  ));
  $this->source = new MigrateSourceSQL($query);
  $this->destination = new MigrateDestinationUser();
  $this->map = new MigrateSQLMap($this->machineName, array(
    'accountid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'description' => 'Account ID.',
    ),
  ), MigrateDestinationUser::getKeySchema());
  $this->systemOfRecord = Migration::DESTINATION;

  // Mapped fields
  $this
    ->addFieldMapping('uid', 'accountid')
    ->sourceMigration('WineUser');
  $this
    ->addFieldMapping('field_migrate_example_gender', 'sex')
    ->description(t('Map from M/F to 0/1 in prepare method'));

  // Unmapped source fields
  // Unmapped destination fields
  $this
    ->addUnmigratedDestinations(array(
    'access',
    'created',
    'data',
    'init',
    'is_new',
    'language',
    'login',
    'mail',
    'name',
    'pass',
    'picture',
    'role_names',
    'roles',
    'signature',
    'signature_format',
    'status',
    'theme',
    'timezone',
  ));
}