diff --git a/core/modules/migrate/src/Plugin/MigrateSourceInterface.php b/core/modules/migrate/src/Plugin/MigrateSourceInterface.php index d320c4b..de3eed2 100644 --- a/core/modules/migrate/src/Plugin/MigrateSourceInterface.php +++ b/core/modules/migrate/src/Plugin/MigrateSourceInterface.php @@ -62,4 +62,12 @@ public function __toString(); */ public function getIds(); + /** + * Run the query that generates the rows for the migration. + * + * @return \Iterator + * The iterator containing the source results. + */ + public function runQuery(); + } diff --git a/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php b/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php index 705e93b..fc7c302 100644 --- a/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php +++ b/core/modules/migrate/src/Plugin/migrate/source/EmptySource.php @@ -30,7 +30,7 @@ public function fields() { /** * {@inheritdoc} */ - public function getIterator() { + public function runQuery() { return new \ArrayIterator(array(array('id' => ''))); } diff --git a/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php b/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php index 8bdf672..e3adcd1 100644 --- a/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php +++ b/core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php @@ -46,7 +46,7 @@ protected $highWaterProperty; /** - * The current row from the quey + * The current row from the query * * @var \Drupal\Migrate\Row */ @@ -219,6 +219,11 @@ public function prepareRow(Row $row) { } /** + * @var \Iterator + */ + protected $iterator; + + /** * Returns the iterator that will yield the row arrays to be processed. * * @return \Iterator @@ -296,6 +301,7 @@ public function next() { // In order to find the next row we want to process, we ask the source // plugin for the next possible row. while (!isset($this->currentRow) && $this->getIterator()->valid()) { + $row_data = $this->getIterator()->current() + $source_configuration; $this->getIterator()->next(); $row = new Row($row_data, $this->migration->getSourcePlugin()->getIds(), $this->migration->get('destinationIds'));