diff --git a/core/modules/migrate/src/Entity/Migration.php b/core/modules/migrate/src/Entity/Migration.php index ba563f1..3357205 100644 --- a/core/modules/migrate/src/Entity/Migration.php +++ b/core/modules/migrate/src/Entity/Migration.php @@ -406,6 +406,13 @@ public function setProcess(array $process) { /** * {@inheritdoc} */ + public function setProcessOfProperty($field_name, $process) { + $this->process[$field_name] = $process; + } + + /** + * {@inheritdoc} + */ public function getSystemOfRecord() { return $this->systemOfRecord; } diff --git a/core/modules/migrate/src/Entity/MigrationInterface.php b/core/modules/migrate/src/Entity/MigrationInterface.php index 09cc770..4e795bf 100644 --- a/core/modules/migrate/src/Entity/MigrationInterface.php +++ b/core/modules/migrate/src/Entity/MigrationInterface.php @@ -188,6 +188,18 @@ public function getMigrationResult(); public function getProcess(); /** + * Set the process for an individual destination field. + * + * @param string $field_name + * The field name of which to set the process. + * @param $process + * An array of process data. + * + * @see Drupal\migrate_drupal\Plugin\migrate\load\LoadEntity::processLinkField(). + */ + public function setProcessOfProperty($field_name, $process); + + /** * Set the current configuration describing the process plugins. * * @param array $process diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php b/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php index c9db0e7..7de8883 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php @@ -98,9 +98,7 @@ public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = N $this->processTextField($field_name, $data, $migration); break; default: - $process = $migration->getProcess(); - $process[$field_name] = $field_name; - $migration->setProcess($process); + $migration->setProcessOfProperty($field_name, $field_name); } } } @@ -134,12 +132,11 @@ protected function processTextField($field_name, $field_data, MigrationInterface $value_key = $field_data['db_storage'] ? $field_name : "$field_name/value"; $format_key = $field_data['db_storage'] ? $field_name . '_format' : "$field_name/format" ; - $process = $migration->getProcess(); + $migration->setProcessOfProperty("$field_name/value", $value_key); - $process["$field_name/value"] = $value_key; // See d6_user, signature_format for an example of the YAML that // represents this process array. - $process["$field_name/format"] = [ + $process = [ [ 'plugin' => 'static_map', 'bypass' => TRUE, @@ -153,8 +150,7 @@ protected function processTextField($field_name, $field_data, MigrationInterface 'source' => $format_key, ], ]; - - $migration->setProcess($process); + $migration->setProcessOfProperty("$field_name/format", $process); } /** @@ -168,8 +164,7 @@ protected function processTextField($field_name, $field_data, MigrationInterface * The migration entity. */ protected function processFileField($field_name, $field_data, MigrationInterface $migration) { - $process = $migration->getProcess(); - $process[$field_name] = [ + $process = [ 'plugin' => 'd6_cck_file', 'source' => [ $field_name, @@ -177,7 +172,7 @@ protected function processFileField($field_name, $field_data, MigrationInterface $field_name . '_data', ], ]; - $migration->setProcess($process); + $migration->setProcessOfProperty($field_name, $process); } /** @@ -193,8 +188,7 @@ protected function processFileField($field_name, $field_data, MigrationInterface protected function processLinkField($field_name, $field_data, MigrationInterface $migration) { // Specifically process the link field until core is fixed. // @see https://www.drupal.org/node/2235457 - $process = $migration->getProcess(); - $process[$field_name] = [ + $process = [ 'plugin' => 'd6_cck_link', 'source' => [ $field_name, @@ -202,7 +196,7 @@ protected function processLinkField($field_name, $field_data, MigrationInterface $field_name . '_attributes', ], ]; - $migration->setProcess($process); + $migration->setProcessOfProperty($field_name, $process); } }