function bibcite_entity_update_8001 in Bibliography & Citation 8
Same name and namespace in other branches
- 2.0.x modules/bibcite_entity/bibcite_entity.install \bibcite_entity_update_8001()
Rename database tables and configuration objects.
File
- modules/bibcite_entity/ bibcite_entity.install, line 18 
- Module installation hooks implementation.
Code
function bibcite_entity_update_8001() {
  $tables_name_mapping = [
    'bibliography' => 'bibcite_reference',
    'bibliography__author' => 'bibcite_reference__author',
    'bibliography__keywords' => 'bibcite_reference__keywords',
  ];
  $database_schema = Database::getConnection()
    ->schema();
  foreach ($tables_name_mapping as $table => $new_name) {
    $database_schema
      ->renameTable($table, $new_name);
  }
  $config_factory = \Drupal::configFactory();
  foreach ($config_factory
    ->listAll('bibcite_entity.bibliography_type') as $config_name) {
    $config = $config_factory
      ->getEditable($config_name);
    $config
      ->setName("bibcite_entity.bibcite_reference_type.{$config->get('id')}");
    $config
      ->save(TRUE);
  }
}