X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmigrate%2Fsrc%2FPlugin%2Fmigrate%2Fdestination%2FEntityRevision.php;h=ff3f0071c7264d92bcd171480c2caaa10db7e984;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=52d0f4fe1576ce557921b62020884d541b568abe;hpb=af6d1fb995500ae68849458ee10d66abbdcfb252;p=yaffs-website diff --git a/web/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php b/web/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php index 52d0f4fe1..ff3f0071c 100644 --- a/web/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php +++ b/web/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php @@ -160,7 +160,9 @@ class EntityRevision extends EntityContentBase { $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; } @@ -177,10 +179,23 @@ class EntityRevision extends EntityContentBase { * {@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; } /**