You are here

public function MigrateDestinationTable::rollback in Migrate 7.2

Same name and namespace in other branches
  1. 6.2 plugins/destinations/table.inc \MigrateDestinationTable::rollback()

Delete a single row.

Parameters

array $ids: The primary key values of the row to be deleted.

1 method overrides MigrateDestinationTable::rollback()
MigrateDestinationRole::rollback in plugins/destinations/user.inc
Delete a single row.

File

plugins/destinations/table.inc, line 64
Support for tables defined through the Schema API.

Class

MigrateDestinationTable
Destination class implementing migration into a single table defined through the Schema API.

Code

public function rollback(array $ids) {
  migrate_instrument_start('table rollback');
  $keys = array_keys(self::getKeySchema($this->tableName));
  $values = array_combine($keys, $ids);
  $this
    ->prepareRollback($values);
  $delete = db_delete($this->tableName);
  foreach ($values as $key => $value) {
    $delete
      ->condition($key, $value);
  }
  $delete
    ->execute();
  $this
    ->completeRollback($values);
  migrate_instrument_stop('table rollback');
}