Quantcast
Viewing all articles
Browse latest Browse all 294883

Migrate does not rollback default translation

When you have a migration with the "translations: true" options on the "entity" destination plugin, nodes are imported fine with their translations. However, on rollback, only the translations are removed, not the base node.

I traced this back to:
http://cgit.drupalcode.org/drupal/tree/core/modules/migrate/src/Plugin/m...

For me the simple fix was to change 248-253 to:

              $translation = $entity->getTranslation($langcode);
              if (!$translation->isDefaultTranslation()) {
                // If this is just a translation, remove the translation.
                $entity->removeTranslation($langcode);
                $entity->save();
              }
              else {
                // If this is the default translation, remove the full entity.
                $entity->delete();
              }

I'm not sure that's the proper fix though.
I think this was introduced in #2225775: Migrate Drupal 6 core node translation to Drupal 8


Viewing all articles
Browse latest Browse all 294883

Trending Articles