public function Sql::__construct in Drupal 9
Same name in this branch
- 9 core/modules/views/src/Plugin/views/query/Sql.php \Drupal\views\Plugin\views\query\Sql::__construct()
- 9 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::__construct()
Same name and namespace in other branches
- 8 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.
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 160
Class
- Sql
- Defines the sql based ID map implementation.
Namespace
Drupal\migrate\Plugin\migrate\id_mapCode
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);
}