X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmigrate%2Fsrc%2FPlugin%2Fmigrate%2Fdestination%2FEntityContentBase.php;h=3e18d28b1ae8a63a3892fd8d36c2574955a117d3;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=8d15cf4bc970b85f3bc4f429180f46cca9d99ac2;hpb=af6d1fb995500ae68849458ee10d66abbdcfb252;p=yaffs-website diff --git a/web/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php b/web/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php index 8d15cf4bc..3e18d28b1 100644 --- a/web/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php +++ b/web/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php @@ -148,7 +148,7 @@ class EntityContentBase extends Entity implements HighestIdInterface { } $ids = $this->save($entity, $old_destination_id_values); - if (!empty($this->configuration['translations'])) { + if ($this->isTranslationDestination()) { $ids[] = $entity->language()->getId(); } return $ids; @@ -181,12 +181,15 @@ class EntityContentBase extends Entity implements HighestIdInterface { * {@inheritdoc} */ public function getIds() { + $ids = []; + $id_key = $this->getKey('id'); $ids[$id_key] = $this->getDefinitionFromEntity($id_key); if ($this->isTranslationDestination()) { - if (!$langcode_key = $this->getKey('langcode')) { - throw new MigrateException('This entity type does not support translation.'); + $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); } @@ -202,8 +205,8 @@ class EntityContentBase extends Entity implements HighestIdInterface { * @param \Drupal\migrate\Row $row * The row object to update from. * - * @return \Drupal\Core\Entity\EntityInterface|null - * An updated entity, or NULL if it's the same as the one passed in. + * @return \Drupal\Core\Entity\EntityInterface + * An updated entity from row values. */ protected function updateEntity(EntityInterface $entity, Row $row) { $empty_destinations = $row->getEmptyDestinationProperties();