diff --git a/core/modules/migrate/src/Entity/Migration.php b/core/modules/migrate/src/Entity/Migration.php index 3357205..f07ba40 100644 --- a/core/modules/migrate/src/Entity/Migration.php +++ b/core/modules/migrate/src/Entity/Migration.php @@ -14,6 +14,7 @@ use Drupal\migrate\MigrateSkipRowException; use Drupal\migrate\Plugin\MigrateIdMapInterface; use Drupal\migrate\Plugin\RequirementsInterface; +use Drupal\Component\Utility\NestedArray; /** * Defines the Migration entity. @@ -406,8 +407,14 @@ public function setProcess(array $process) { /** * {@inheritdoc} */ - public function setProcessOfProperty($field_name, $process) { - $this->process[$field_name] = $process; + public function setProcessOfProperty($field_name, $process, $merge = TRUE) { + if (isset($this->process[$field_name]) && is_array($process) && $merge) { + $this->process = NestedArray::mergeDeepArray([$this->process, [$field_name => $process]], TRUE); + } + else { + $this->process[$field_name] = $process; + } + return $this; } /** diff --git a/core/modules/migrate/src/Entity/MigrationInterface.php b/core/modules/migrate/src/Entity/MigrationInterface.php index 4e795bf..ca9ac03 100644 --- a/core/modules/migrate/src/Entity/MigrationInterface.php +++ b/core/modules/migrate/src/Entity/MigrationInterface.php @@ -188,26 +188,31 @@ public function getMigrationResult(); public function getProcess(); /** - * Set the process for an individual destination field. + * Set the current configuration describing the process plugins. * - * @param string $field_name - * The field name of which to set the process. - * @param $process - * An array of process data. + * @param array $process + * The configuration describing the process plugins. * - * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField(). + * @return $this */ - public function setProcessOfProperty($field_name, $process); + public function setProcess(array $process); /** - * Set the current configuration describing the process plugins. + * Set the process for an individual destination field. * + * @param string $field_name + * The field name of which to set the process. * @param array $process - * The configuration describing the process plugins. + * An array of process data. + * @param boolean $merge + * (optional) TRUE if we should merge the process arrays otherwise FALSE. * * @return $this + * The migration entity. + * + * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField(). */ - public function setProcess(array $process); + public function setProcessOfProperty($field_name, $process, $merge = TRUE); /** * Get the current system of record of the migration.