Node status of entity_translation_revision table was not respected in NodeComplete.php on D7 to D9

Created on 13 April 2022, over 3 years ago
Updated 24 May 2025, 4 months ago

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

Becomes

D9
original language: published
en-US: published

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

🐛 Bug report
Status

Postponed

Version

11.0 🔥

Component

migration system

Created by

🇹🇼Taiwan g-brodiei

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024