You are here

public function MigrateSQLMap::delete in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/sources/sqlmap.inc \MigrateSQLMap::delete()

Delete the map entry and any message table entries for the specified source row.

Parameters

array $source_key:

Overrides MigrateMap::delete

File

plugins/sources/sqlmap.inc, line 578
Defines a Drupal db-based implementation of MigrateMap.

Class

MigrateSQLMap
@file Defines a Drupal db-based implementation of MigrateMap.

Code

public function delete(array $source_key, $messages_only = FALSE) {
  if (!$messages_only) {
    $map_query = $this->connection
      ->delete($this->mapTable);
  }
  $message_query = $this->connection
    ->delete($this->messageTable);
  $count = 1;
  foreach ($source_key as $key_value) {
    if (!$messages_only) {
      $map_query
        ->condition('sourceid' . $count, $key_value);
    }
    $message_query
      ->condition('sourceid' . $count, $key_value);
    $count++;
  }
  if (!$messages_only) {
    $map_query
      ->execute();
  }
  $message_query
    ->execute();
}