You are here

function mongodb_migrate_write_helper in MongoDB 7

Mark migrated entity as having its fields deleted in SQL storage.

Parameters

string $entity_type: The type of the entity to update.

int $entity_id: The ID of the entity to update.

File

mongodb_migrate/mongodb_migrate.module, line 49
The mongodb_migrate module provides SQL to MongoDB migration helpers.

Code

function mongodb_migrate_write_helper($entity_type, $entity_id) {
  $migrate_fields = variable_get('mongodb_migrate_fields', []);
  foreach ($migrate_fields as $field_name => $v) {
    $field = field_info_field($field_name);
    db_update(_field_sql_storage_tablename($field))
      ->fields([
      'deleted' => 2,
    ])
      ->condition('entity_type', $entity_type)
      ->condition('entity_id', $entity_id)
      ->execute();
  }
}