public function Sql::saveMessage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/migrate/src/Plugin/migrate/id_map/Sql.php \Drupal\migrate\Plugin\migrate\id_map\Sql::saveMessage()
Saves a message related to a source record in the migration message table.
Parameters
array $source_id_values: The source identifier keyed values of the record, e.g. ['nid' => 5].
string $message: The message to record.
int $level: Optional message severity (defaults to MESSAGE_ERROR).
Overrides MigrateIdMapInterface::saveMessage
File
- core/
modules/ migrate/ src/ Plugin/ migrate/ id_map/ Sql.php, line 554 - Contains \Drupal\migrate\Plugin\migrate\id_map\Sql.
Class
- Sql
- Defines the sql based ID map implementation.
Namespace
Drupal\migrate\Plugin\migrate\id_mapCode
public function saveMessage(array $source_id_values, $message, $level = MigrationInterface::MESSAGE_ERROR) {
foreach ($this
->sourceIdFields() as $field_name => $source_id) {
// If any key value is not set, we can't save.
if (!isset($source_id_values[$field_name])) {
return;
}
$fields[$source_id] = $source_id_values[$field_name];
}
$fields['level'] = $level;
$fields['message'] = $message;
$this
->getDatabase()
->insert($this
->messageTableName())
->fields($fields)
->execute();
// Notify anyone listening of the message we've saved.
$this->eventDispatcher
->dispatch(MigrateEvents::IDMAP_MESSAGE, new MigrateIdMapMessageEvent($this->migration, $source_id_values, $message, $level));
}