You are here

protected function YamlFormToWebformMigrateManager::renameTable in YAML Form 8

Rename a table.

Parameters

string $table_name: The table name.

Return value

array An associative array containing status messages.

1 call to YamlFormToWebformMigrateManager::renameTable()
YamlFormToWebformMigrateManager::migrate in modules/yamlform_to_webform/src/YamlFormToWebformMigrateManager.php
Migrate the YAML Form module's configuration and data to the Webform module.

File

modules/yamlform_to_webform/src/YamlFormToWebformMigrateManager.php, line 253

Class

YamlFormToWebformMigrateManager
Defines the YAML Form to Webform migrate manager.

Namespace

Drupal\yamlform_to_webform

Code

protected function renameTable($table_name) {
  if (strpos($table_name, 'yamlform') === FALSE && strpos($table_name, 'yaml_form') === FALSE) {
    return [];
  }
  $new_table_name = str_replace([
    'yamlform',
    'yaml_form',
  ], [
    'webform',
    'webform',
  ], $table_name);
  $t_args = [
    '@source' => $table_name,
    '@destination' => $new_table_name,
  ];
  $this->connection
    ->query("RENAME TABLE {$table_name} TO {$new_table_name}");
  return [
    "{$table_name}" => $this
      ->t("Renamed '@source' to '@destination'", $t_args),
  ];
}