You are here

public function WineCommentUpdatesMigration::__construct in Migrate 7.2

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

General initialization of a Migration object.

Overrides AdvancedExampleMigration::__construct

File

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

Class

WineCommentUpdatesMigration

Code

public function __construct($arguments) {
  parent::__construct($arguments);
  $this->description = 'Update wine comments';
  $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->map = new MigrateSQLMap($this->machineName, array(
    'commentid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
    ),
  ), MigrateDestinationComment::getKeySchema());
  $this->systemOfRecord = Migration::DESTINATION;

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

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