public function MigrateSourceMultiItems::getNextRow in Migrate 6.2
Same name and namespace in other branches
- 7.2 plugins/sources/multiitems.inc \MigrateSourceMultiItems::getNextRow()
Implementation of MigrateSource::getNextRow().
Return value
null|stdClass
File
- plugins/
sources/ multiitems.inc, line 162 - Support for migration from sources where data spans multiple lines (ex. xml, json) and IDs for the items are part of each item and multiple items reside in a single file.
Class
- MigrateSourceMultiItems
- Implementation of MigrateSource, providing the semantics of iterating over IDs provided by a MigrateItems and retrieving data from a MigrateItems.
Code
public function getNextRow() {
$row = NULL;
while ($this->idIterator
->valid()) {
$id = $this->idIterator
->current();
$this->idIterator
->next();
// Skip empty IDs
if (empty($id)) {
continue;
}
// Got a good ID, get the data and get out.
$row = $this->itemsClass
->getItem($id);
if ($row) {
// Save the ID using the map source key - it will be used for mapping
$sourceKey = $this->activeMap
->getSourceKey();
$key_name = key($sourceKey);
$row->{$key_name} = $id;
}
break;
}
return $row;
}