You are here

public static function ConvertNodes::convertBaseTables in Convert Nodes 8

File

src/ConvertNodes.php, line 180

Class

ConvertNodes
ConvertNodes.

Namespace

Drupal\convert_nodes

Code

public static function convertBaseTables($base_table_names, $nids, $to_type, &$context) {
  $message = 'Converting Base Tables...';
  $results = [];
  $db = Database::getConnection();

  // Base tables have 'nid' and 'type' columns.
  foreach ($base_table_names as $table_name) {
    $results[] = $db
      ->update($table_name)
      ->fields([
      'type' => $to_type,
    ])
      ->condition('nid', $nids, 'IN')
      ->execute();
  }
  $context['message'] = $message;
  $context['results'] = $results;
}