You are here

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

Required arguments:

source_connection - Connection key for the DatabaseConnection holding the source Drupal installation. source_version - Major version number (as an integer) of the source install. machine_name - Machine name under which a particular migration is registered. description - Description of the migration. group_name - The group (import job) containing this migration (import task).

Optional arguments:

source_database - Array describing the source connection, to be defined in the constructor. If absent, the source connection is assumed to be established elsewhere (typically settings.php). group - Migration group to add this migration to. dependencies - Array of migrations that must be run before this one. soft_dependencies - Array of migrations that should be listed before this one. format_mappings - Array keyed by source format IDs or machine names, with the values being the corresponding D7 machine name. If unspecified, source_options - Array to be passed as options to source constructors, overriding the defaults (map_joinable FALSE, cache_counts TRUE, cache_key derived from the machine name). version_class - The name of a custom DrupalVersion class overriding the default derived from source_version. new_only - For any destination types that support highwater marks or track_changes, suppress that support so repeated migrations only import new items.

Parameters

array $arguments:

Overrides Migration::__construct

11 calls to DrupalMigration::__construct()
DrupalCommentMigration::__construct in ./comment.inc
DrupalCustomBlockMigration::__construct in ./block_custom.inc
DrupalEntityMigration::__construct in ./entity.inc
DrupalFileMigration::__construct in ./file.inc
Required arguments:
DrupalMenuLinksMigration::__construct in ./menu_links.inc
@todo: should the arguments be handled here or in d6/menu_links?

... See full list

11 methods override DrupalMigration::__construct()
DrupalCommentMigration::__construct in ./comment.inc
DrupalCustomBlockMigration::__construct in ./block_custom.inc
DrupalEntityMigration::__construct in ./entity.inc
DrupalFileMigration::__construct in ./file.inc
Required arguments:
DrupalMenuLinksMigration::__construct in ./menu_links.inc
@todo: should the arguments be handled here or in d6/menu_links?

... See full list

File

./migrate_d2d.migrate.inc, line 114
Base classes for all Drupal-to-Drupal migration classes.

Class

DrupalMigration
@file Base classes for all Drupal-to-Drupal migration classes.

Code

public function __construct($arguments) {
  parent::__construct($arguments);
  if (empty($this->arguments['source_version'])) {
    throw new MigrateException(t('No source_version provided in migrate_d2d migration arguments.'));
  }
  else {
    $this->sourceVersion = $this->arguments['source_version'];
  }
  if (isset($this->arguments['version_class'])) {
    $version_class = $this->arguments['version_class'];
  }
  else {
    $version_class = 'DrupalVersion' . $this->sourceVersion;
  }
  $this->version = new $version_class($this->arguments);
  if (!isset($this->arguments['group'])) {
    $this->arguments['group'] = MigrateGroup::getInstance($this->arguments['group_name']);
  }
  elseif (!is_object($this->arguments['group'])) {
    $this->arguments['group'] = MigrateGroup::getInstance($this->arguments['group']);
  }
  $this->sourceConnection = $this->arguments['source_connection'];
  if (!empty($this->arguments['source_database'])) {
    Database::addConnectionInfo($this->sourceConnection, 'default', $this->arguments['source_database']);
  }
  if (!empty($this->arguments['source_type'])) {
    $this->sourceType = $this->arguments['source_type'];
  }
  $this->description = $this->arguments['description'];
  if (!empty($this->arguments['dependencies'])) {
    $this->dependencies = $this->arguments['dependencies'];
  }
  if (!empty($this->arguments['soft_dependencies'])) {
    $this->softDependencies = $this->arguments['soft_dependencies'];
  }
  $this->sourceOptions = array(
    'map_joinable' => FALSE,
    'cache_counts' => TRUE,
    'cache_key' => 'migrate_' . $this->machineName,
  );
  if (!empty($this->arguments['source_options'])) {
    $this->sourceOptions = array_merge($this->sourceOptions, $this->arguments['source_options']);
  }
  if (!empty($this->arguments['format_mappings'])) {
    $this->formatMappings = $this->arguments['format_mappings'];
  }
  else {
    $this->formatMappings = $this->version
      ->getDefaultFormatMappings();
  }
  if (!empty($this->arguments['new_only'])) {
    $this->newOnly = $this->arguments['new_only'];
  }
  if (!empty($this->arguments['map_connection'])) {
    $this->mapConnection = $this->arguments['map_connection'];
  }
}