protected function MigrateBatchExecutable::batchOperations in Migrate source UI 8
Helper to generate the batch operations for importing migrations.
Parameters
\Drupal\migrate\Plugin\MigrationInterface[] $migrations: The migrations.
string $operation: The batch operation to perform.
array $options: The migration options.
Return value
array The batch operations to perform.
File
- src/
MigrateBatchExecutable.php, line 42
Class
- MigrateBatchExecutable
- Defines a migrate executable class for batch migrations through UI.
Namespace
Drupal\migrate_source_uiCode
protected function batchOperations(array $migrations, $operation, array $options = []) {
$operations = [];
foreach ($migrations as $migration) {
if (!empty($options['update'])) {
$migration
->getIdMap()
->prepareUpdate();
}
if (!empty($options['force'])) {
$migration
->set('requirements', []);
}
else {
$dependencies = $migration
->getMigrationDependencies();
if (!empty($dependencies['required'])) {
$required_migrations = $this->migrationPluginManager
->createInstances($dependencies['required']);
// For dependent migrations will need to be migrate all items.
$operations += $this
->batchOperations($required_migrations, $operation, [
'limit' => 0,
'update' => $options['update'],
'force' => $options['force'],
]);
}
}
$operations[] = [
[
get_class($this),
'batchProcessImport',
],
[
$migration
->id(),
$options + [
'file_path' => $this->filePath,
],
],
];
}
return $operations;
}