Problem/Motivation

D7 + entity_translations 7.x-1.0-beta7

While using NodeComplete.php as source plugin for migrating a nodes from D7 to D9, we discovered the status column value of entity_translation_revision was not used as the source of import on the original source of translation. Which makes some nodes that have their original language being unpublished on d7, now published on d9 after migration.

Scenario:

D7
original language: unpublished
en-US: published

Image showing original translation unpublished D7

Becomes

D9
original language: published
en-US: published

Image showing original translation published on D9

Compare table of node_revision against entity_translation_revision upon their publish status

Image showing entity translation revision table with revision ID 13466 publish status as 0

Image showing node revision table with revision ID 13466 publish status as 1

Steps to reproduce

Proposed resolution

Alter the prepareRow() in NodeComplete.php by replacing 'status' with 'etr_status'

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    // Override properties when this is an entity translation revision. The tnid
    // will be set in d7_node source plugin to the value of 'nid'.
    if ($row->getSourceProperty('etr_created')) {
      $row->setSourceProperty('vid', $row->getSourceProperty('revision_id'));
      $row->setSourceProperty('status', $row->getSourceProperty('etr_status'));  <--- add this line
      $row->setSourceProperty('created', $row->getSourceProperty('etr_created'));
      $row->setSourceProperty('timestamp', $row->getSourceProperty('etr_changed'));
      $row->setSourceProperty('revision_uid', $row->getSourceProperty('etr_uid'));
      $row->setSourceProperty('source_langcode', $row->getSourceProperty('source'));
    }
    return parent::prepareRow($row);
  }

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

g-brodiei created an issue. See original summary.

g-brodiei’s picture

Issue summary: View changes
StatusFileSize
new907 bytes
new275.12 KB
new297.6 KB

Provide patch without test. This patch solved the issue by setting/override the status source value we needed from entity_translation_revision table over node_revision table on NodeComplete.php file.

Update new image of query results comparing node_revision table and entity_translation_revision table on the same node's revision ID 13466.

Might need test?

quietone’s picture

Status: Active » Needs work
Issue tags: +Needs tests

@g-brodiei, thanks for the issue and patch.

On a cursory look, this makes sense to me. And yes, this will need a test. The status field is tested in MigrateNodeCompleteTest and it is always '1'. I think we need to either edit a node in the D7 fixture or add a new node.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue tags: +migrate-d7-d8

Just updating tags,

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

g-brodiei’s picture

Issue summary: View changes

Fix summary pointing to wrong language. Japanese to en-US

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

The Migrate Drupal Module was approved for removal in #3371229: [Policy] Migrate Drupal and Migrate Drupal UI after Drupal 7 EOL.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3522602: [meta] Tasks to remove Migrate Drupal module and the removal work in #3522602: [meta] Tasks to remove Migrate Drupal module.

Migrate Drupal will not be moved to a contributed project. It will be removed from core after the Drupal 12.x branch is open.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.