Same name and namespace in other branches
  1. 8.9.x core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::__construct()
  2. 9 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::__construct()

Constructs an SQL object.

Sets up the tables and builds the maps,

Parameters

array $configuration: The configuration.

string $plugin_id: The plugin ID for the migration process to do.

mixed $plugin_definition: The configuration for the plugin.

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration to do.

\Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher: The event dispatcher.

\Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager: The migration plugin manager.

Overrides PluginBase::__construct

1 call to Sql::__construct()
TestSqlIdMap::__construct in core/modules/migrate/tests/src/Unit/TestSqlIdMap.php
Constructs a TestSqlIdMap object.
1 method overrides Sql::__construct()
TestSqlIdMap::__construct in core/modules/migrate/tests/src/Unit/TestSqlIdMap.php
Constructs a TestSqlIdMap object.

File

core/modules/migrate/src/Plugin/migrate/id_map/Sql.php, line 173

Class

Sql

Namespace

Drupal\migrate\Plugin\migrate\id_map

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EventDispatcherInterface $event_dispatcher, MigrationPluginManagerInterface $migration_plugin_manager = NULL) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->migration = $migration;
  $this->eventDispatcher = $event_dispatcher;
  $this->message = new MigrateMessage();
  if (!isset($this->database)) {
    $this->database = \Drupal::database();
  }

  // Default generated table names, limited to 63 characters.
  $machine_name = str_replace(':', '__', $this->migration
    ->id());
  $prefix_length = strlen($this->database
    ->getPrefix());
  $this->mapTableName = 'migrate_map_' . mb_strtolower($machine_name);
  $this->mapTableName = mb_substr($this->mapTableName, 0, 63 - $prefix_length);
  $this->messageTableName = 'migrate_message_' . mb_strtolower($machine_name);
  $this->messageTableName = mb_substr($this->messageTableName, 0, 63 - $prefix_length);
  if (!$migration_plugin_manager) {
    @trigger_error('Calling Sql::__construct() without the $migration_manager argument is deprecated in drupal:9.5.0 and the $migration_manager argument will be required in drupal:11.0.0. See https://www.drupal.org/node/3277306', E_USER_DEPRECATED);
    $migration_plugin_manager = \Drupal::service('plugin.manager.migration');
  }
  $this->migrationPluginManager = $migration_plugin_manager;
}