You are here

public function WineUserUpdatesMigration::__construct in Migrate 6.2

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

General initialization of a Migration object.

Overrides AdvancedExampleMigration::__construct

File

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

Class

WineUserUpdatesMigration

Code

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

  // Mapped fields
  $this
    ->addFieldMapping('uid', 'accountid')
    ->sourceMigration('WineUser');

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