function Sql::__construct

Same name in this branch
  1. 8.9.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::__construct()
Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::__construct()
  2. 9 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::__construct()
  3. 10 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::__construct()
  4. 10 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::__construct()
  5. 11.x core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::__construct()
  6. 11.x 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\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: The event dispatcher.

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 160

Class

Sql
Defines the sql based ID map implementation.

Namespace

Drupal\migrate\Plugin\migrate\id_map

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EventDispatcherInterface $event_dispatcher) {
    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
        ->tablePrefix());
    $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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.