diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php index 81b8f21..323de4c 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityContentBase.php @@ -185,7 +185,7 @@ public function getIds() { $this->addDestinationId($ids, 'id'); if ($this->isTranslationDestination()) { - $this->addDestinationId($ids, 'langcode', new MigrateException('This entity type does not support translation.')); + $this->addDestinationId($ids, 'langcode', 'This entity type does not support translation.'); } return $ids; @@ -199,20 +199,20 @@ public function getIds() { * @param string $key * The entity key to add. See * \Drupal\Core\Entity\EntityTypeInterface::getKeys() for more info. - * @param \Exception $error - * (optional) An exception to throw if the current entity type does not have - * the specified $key. + * @param string $error_message + * (optional) An exception message to throw if the current entity type does + * not have the specified $key. * * @throws \Exception * If the current entity type does have the specified $key. */ - protected function addDestinationId(array &$ids, $key, \Exception $error = NULL) { + protected function addDestinationId(array &$ids, $key, $error_message = NULL) { $key = $this->getKey($key); if ($key) { $ids[$key] = $this->getDefinitionFromEntity($key); } - elseif ($error) { - throw $error; + elseif ($error_message) { + throw new MigrateException($error_message); } } diff --git a/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php index 3664e82..db00ad8 100644 --- a/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php +++ b/core/modules/migrate/src/Plugin/migrate/destination/EntityRevision.php @@ -180,10 +180,10 @@ protected function save(ContentEntityInterface $entity, array $old_destination_i */ public function getIds() { $ids = []; - $this->addDestinationId($ids, 'revision', new MigrateException('This entity type does not support revisions.')); + $this->addDestinationId($ids, 'revision', 'This entity type does not support revisions.'); if ($this->isTranslationDestination()) { - $this->addDestinationId($ids, 'langcode', new MigrateException('This entity type does not support translation.')); + $this->addDestinationId($ids, 'langcode', 'This entity type does not support translation.'); } return $ids;