You are here

public function WineCommentUpdatesMigration::__construct in Migrate 6.2

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

General initialization of a Migration object.

Overrides AdvancedExampleMigration::__construct

File

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

Class

WineCommentUpdatesMigration

Code

public function __construct() {
  parent::__construct();
  $this->description = 'Update wine comments';
  $this->dependencies = array(
    'WineComment',
  );
  $this->softDependencies = array(
    'WineUpdates',
  );
  $this->map = new MigrateSQLMap($this->machineName, array(
    'commentid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ),
  ), MigrateDestinationComment::getKeySchema());
  $query = db_select('migrate_example_wine_comment_updates', 'wc')
    ->fields('wc', array(
    'commentid',
    'subject',
  ));
  $this->source = new MigrateSourceSQL($query);
  $this->destination = new MigrateDestinationComment('comment_node_migrate_example_wine');
  $this->systemOfRecord = Migration::DESTINATION;

  // Mapped fields
  $this
    ->addFieldMapping('cid', 'commentid')
    ->sourceMigration('WineComment');
  $this
    ->addFieldMapping('subject', 'subject');

  // No unmapped source fields
  // Unmapped destination fields
  $this
    ->addFieldMapping('name');
  $this
    ->addFieldMapping('mail');
  $this
    ->addFieldMapping('status');
  $this
    ->addFieldMapping('nid');
  $this
    ->addFieldMapping('uid');
  $this
    ->addFieldMapping('pid');
  $this
    ->addFieldMapping('comment_body');
  $this
    ->addFieldMapping('hostname');
  $this
    ->addFieldMapping('created');
  $this
    ->addFieldMapping('changed');
  $this
    ->addFieldMapping('homepage');
  $this
    ->addUnmigratedDestinations(array(
    'thread',
    'language',
  ));
}