$entity->enforceIsNew(FALSE);
$entity->setNewRevision(TRUE);
}
- $this->updateEntity($entity, $row);
+ // We need to update the entity, so that the destination row IDs are
+ // correct.
+ $entity = $this->updateEntity($entity, $row);
$entity->isDefaultRevision(FALSE);
return $entity;
}
* {@inheritdoc}
*/
public function getIds() {
- if ($key = $this->getKey('revision')) {
- return [$key => $this->getDefinitionFromEntity($key)];
+ $ids = [];
+
+ $revision_key = $this->getKey('revision');
+ if (!$revision_key) {
+ throw new MigrateException(sprintf('The "%s" entity type does not support revisions.', $this->storage->getEntityTypeId()));
}
- throw new MigrateException('This entity type does not support revisions.');
+ $ids[$revision_key] = $this->getDefinitionFromEntity($revision_key);
+
+ if ($this->isTranslationDestination()) {
+ $langcode_key = $this->getKey('langcode');
+ if (!$langcode_key) {
+ throw new MigrateException(sprintf('The "%s" entity type does not support translations.', $this->storage->getEntityTypeId()));
+ }
+ $ids[$langcode_key] = $this->getDefinitionFromEntity($langcode_key);
+ }
+
+ return $ids;
}
/**