You are here

protected function Sql::init in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::init()
  2. 8 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::init()
Same name and namespace in other branches
  1. 8.0 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::init()

Initialize the plugin.

3 calls to Sql::init()
Sql::getDatabase in core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
Gets the database connection.
Sql::mapTableName in core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
The name of the database map table.
Sql::messageTableName in core/modules/migrate/src/Plugin/migrate/id_map/Sql.php
The name of the database message table.

File

core/modules/migrate/src/Plugin/migrate/id_map/Sql.php, line 256
Contains \Drupal\migrate\Plugin\migrate\id_map\Sql.

Class

Sql
Defines the sql based ID map implementation.

Namespace

Drupal\migrate\Plugin\migrate\id_map

Code

protected function init() {
  if (!$this->initialized) {
    $this->initialized = TRUE;

    // Default generated table names, limited to 63 characters.
    $machine_name = str_replace(':', '__', $this->migration
      ->id());
    $prefix_length = strlen($this
      ->getDatabase()
      ->tablePrefix());
    $this->mapTableName = 'migrate_map_' . Unicode::strtolower($machine_name);
    $this->mapTableName = Unicode::substr($this->mapTableName, 0, 63 - $prefix_length);
    $this->messageTableName = 'migrate_message_' . Unicode::strtolower($machine_name);
    $this->messageTableName = Unicode::substr($this->messageTableName, 0, 63 - $prefix_length);
    $this
      ->ensureTables();
  }
}