public function MigrateSQLMap::deleteBulk in Migrate 7.2
Same name and namespace in other branches
- 6.2 plugins/sources/sqlmap.inc \MigrateSQLMap::deleteBulk()
Delete all map and message table entries specified.
Parameters
array $source_keys: Each array member is an array of key fields for one source row.
Overrides MigrateMap::deleteBulk
File
- plugins/
sources/ sqlmap.inc, line 643 - Defines a Drupal db-based implementation of MigrateMap.
Class
- MigrateSQLMap
- @file Defines a Drupal db-based implementation of MigrateMap.
Code
public function deleteBulk(array $source_keys) {
// If we have a single-column key, we can shortcut it.
if (count($this->sourceKey) == 1) {
$sourceids = array();
foreach ($source_keys as $source_key) {
$sourceids[] = $source_key;
}
$this->connection
->delete($this->mapTable)
->condition('sourceid1', $sourceids, 'IN')
->execute();
$this->connection
->delete($this->messageTable)
->condition('sourceid1', $sourceids, 'IN')
->execute();
}
else {
foreach ($source_keys as $source_key) {
$map_query = $this->connection
->delete($this->mapTable);
$message_query = $this->connection
->delete($this->messageTable);
$count = 1;
foreach ($source_key as $key_value) {
$map_query
->condition('sourceid' . $count, $key_value);
$message_query
->condition('sourceid' . $count++, $key_value);
}
$map_query
->execute();
$message_query
->execute();
}
}
}