*/
protected $migration_tags = [];
+ /**
+ * Whether the migration is auditable.
+ *
+ * If set to TRUE, the migration's IDs will be audited. This means that, if
+ * the highest destination ID is greater than the highest source ID, a warning
+ * will be displayed that entities might be overwritten.
+ *
+ * @var bool
+ */
+ protected $audit = FALSE;
+
/**
* These migrations, if run, must be executed before this migration.
*
protected $sourcePluginManager;
/**
- * Thep process plugin manager.
+ * The process plugin manager.
*
* @var \Drupal\migrate\Plugin\MigratePluginManager
*/
*/
public function getDestinationPlugin($stub_being_requested = FALSE) {
if ($stub_being_requested && !empty($this->destination['no_stub'])) {
- throw new MigrateSkipRowException();
+ throw new MigrateSkipRowException('Stub requested but not made because no_stub configuration is set.');
}
if (!isset($this->destinationPlugin)) {
$this->destinationPlugin = $this->destinationPluginManager->createInstance($this->destination['plugin'], $this->destination, $this);
return $this;
}
-
/**
* {@inheritdoc}
*/
}
/**
- * Find migration dependencies from the migration and the iterator plugins.
+ * Find migration dependencies from migration_lookup and sub_process plugins.
+ *
+ * @param array $process
+ * A process configuration array.
*
- * @param $process
* @return array
+ * The migration dependencies.
*/
protected function findMigrationDependencies($process) {
$return = [];
foreach ($this->getProcessNormalized($process) as $process_pipeline) {
foreach ($process_pipeline as $plugin_configuration) {
- if ($plugin_configuration['plugin'] == 'migration') {
+ if (in_array($plugin_configuration['plugin'], ['migration', 'migration_lookup'], TRUE)) {
$return = array_merge($return, (array) $plugin_configuration['migration']);
}
- if ($plugin_configuration['plugin'] == 'sub_process') {
+ if (in_array($plugin_configuration['plugin'], ['iterator', 'sub_process'], TRUE)) {
$return = array_merge($return, $this->findMigrationDependencies($plugin_configuration['process']));
}
}
return $this->migration_tags;
}
+ /**
+ * {@inheritdoc}
+ */
+ public function isAuditable() {
+ return (bool) $this->audit;
+ }
+
}