*/
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
*/
*
* @deprecated in Drupal 8.1.x, will be removed before Drupal 9.0.x. Use
* more specific getters instead.
+ *
+ * @see https://www.drupal.org/node/2873795
*/
public function get($property) {
return isset($this->$property) ? $this->$property : NULL;
*/
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}
*/
*/
public function mergeProcessOfProperty($property, array $process_of_property) {
// If we already have a process value then merge the incoming process array
- //otherwise simply set it.
+ // otherwise simply set it.
$current_process = $this->getProcess();
if (isset($current_process[$property])) {
$this->process = NestedArray::mergeDeepArray([$current_process, $this->getProcessNormalized([$property => $process_of_property])], TRUE);
}
/**
- * 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'] == 'iterator') {
+ 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;
+ }
+
}