You are here

public function DrupalEntityMigration::__construct in Drupal-to-Drupal data migration 7.2

Parameters

array $arguments:

Overrides DrupalMigration::__construct

1 call to DrupalEntityMigration::__construct()
DrupalEntity6Migration::__construct in d6/entity.inc
1 method overrides DrupalEntityMigration::__construct()
DrupalEntity6Migration::__construct in d6/entity.inc

File

./entity.inc, line 55
Base class for migrating nodes into Drupal custom entities.

Class

DrupalEntityMigration
Base class for all non-standard entity migrations - handles commonalities across all supported source Drupal versions.

Code

public function __construct(array $arguments) {
  $this->entityType = $arguments['destination_entity_type'];
  $this->bundle = $arguments['destination_bundle'];
  if (!empty($arguments['default_language'])) {
    $this->defaultLanguage = $arguments['default_language'];
  }
  parent::__construct($arguments);
  $this->sourceFields += $this->version
    ->getSourceFields('node', $this->sourceType);
  $this->destination = new MigrateDestinationEntityAPI($this->entityType, $this->bundle, array(
    'language' => $this->defaultLanguage,
  ));
  $this->map = new MigrateSQLMap($this->machineName, array(
    'nid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'description' => 'Source node ID',
      'alias' => 'n',
    ),
  ), MigrateDestinationEntityAPI::getKeySchema($this->entityType), $this->mapConnection);
  if (!$this->newOnly) {
    $this->highwaterField = array(
      'name' => 'changed',
      'alias' => 'n',
      'type' => 'int',
    );
  }

  // Ignore by default
  $this
    ->addUnmigratedSources(array(
    'body',
    'changed',
    'comment',
    'created',
    'moderate',
    'promote',
    'status',
    'sticky',
    'uid',
    'vid',
  ));
}