SmartSql.php in Smart SQL ID Map 1.0.x
File
src/Plugin/migrate/id_map/SmartSql.php
View source
<?php
namespace Drupal\smart_sql_idmap\Plugin\migrate\id_map;
use Drupal\Component\Plugin\PluginBase;
use Drupal\migrate\Plugin\migrate\id_map\Sql;
use Drupal\migrate\Plugin\MigrationInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
class SmartSql extends Sql {
public function __construct(array $configuration, $plugin_id, $plugin_definition, MigrationInterface $migration, EventDispatcherInterface $event_dispatcher) {
parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $event_dispatcher);
$machine_name = str_replace(PluginBase::DERIVATIVE_SEPARATOR, '__', $this->migration
->id());
$prefix_length = strlen($this->database
->tablePrefix());
$map_table_name = 'm_map_' . mb_strtolower($machine_name);
$this->mapTableName = mb_substr($map_table_name, 0, 63 - $prefix_length) === $map_table_name ? $map_table_name : mb_substr($map_table_name, 0, 45 - $prefix_length) . '_' . substr(md5($machine_name), 0, 17);
$message_table_name = 'm_message_' . mb_strtolower($machine_name);
$this->messageTableName = mb_substr($message_table_name, 0, 63 - $prefix_length) === $message_table_name ? $message_table_name : mb_substr($message_table_name, 0, 45 - $prefix_length) . '_' . substr(md5($machine_name), 0, 17);
}
}