public function MigrateSQLMap::saveMessage in Migrate 6.2
Same name and namespace in other branches
- 7.2 plugins/sources/sqlmap.inc \MigrateSQLMap::saveMessage()
Record a message in the migration's message table.
Parameters
array $source_key: Source ID of the record in error
string $message: The message to record.
int $level: Optional message severity (defaults to MESSAGE_ERROR).
Overrides MigrateMap::saveMessage
File
- plugins/
sources/ sqlmap.inc, line 351 - Defines a Drupal db-based implementation of MigrateMap.
Class
- MigrateSQLMap
- @file Defines a Drupal db-based implementation of MigrateMap.
Code
public function saveMessage($source_key, $message, $level = Migration::MESSAGE_ERROR) {
// Source IDs as arguments
$count = 1;
if (is_array($source_key)) {
foreach ($source_key as $key_value) {
$fields['sourceid' . $count++] = $key_value;
// If any key value is empty, we can't save - print out and abort
if (empty($key_value)) {
print $message;
return;
}
}
$fields['level'] = $level;
$fields['message'] = $message;
$this->connection
->insert($this->messageTable)
->fields($fields)
->execute();
}
else {
// TODO: What else can we do?
Migration::displayMessage($message);
}
}