public function Sql::getMessageIterator 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::getMessageIterator()
Retrieves an iterator over messages relate to source records.
Parameters
array $source_id_values: (optional) The source identifier keyed values of the record, e.g. ['nid' => 5]. If empty, all messages are retrieved.
int $level: (optional) Message severity. If NULL, retrieve messages of all severities.
Return value
\Iterator Retrieves an iterator over the message rows.
Overrides MigrateIdMapInterface::getMessageIterator
File
- core/
modules/ migrate/ src/ Plugin/ migrate/ id_map/ Sql.php, line 576 - 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 getMessageIterator(array $source_id_values = [], $level = NULL) {
$query = $this
->getDatabase()
->select($this
->messageTableName(), 'msg')
->fields('msg');
foreach ($this
->sourceIdFields() as $field_name => $source_id) {
if (isset($source_id_values[$field_name])) {
$query
->condition($source_id, $source_id_values[$field_name]);
}
}
if ($level) {
$query
->condition('level', $level);
}
return $query
->execute();
}