diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index 285bae2d21..a3bb20508f 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -151,8 +151,7 @@ protected function initFieldValues(ContentEntityInterface $entity, array $values /** * {@inheritdoc} */ - public function createTranslation(TranslatableInterface $entity, $langcode, array $values = []) { - /** @var \Drupal\Core\Entity\ContentEntityInterface $translation */ + public function createTranslation(ContentEntityInterface $entity, $langcode, array $values = []) { $translation = $entity->getTranslation($langcode); $definitions = array_filter($translation->getFieldDefinitions(), function (FieldDefinitionInterface $definition) { return $definition->isTranslatable(); diff --git a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php index 3724d4329a..2c57405c19 100644 --- a/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php +++ b/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueContentEntityStorage.php @@ -2,8 +2,8 @@ namespace Drupal\Core\Entity\KeyValueStore; +use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\ContentEntityStorageInterface; -use Drupal\Core\Entity\TranslatableInterface; /** * Provides a key value backend for content entities. @@ -13,7 +13,7 @@ class KeyValueContentEntityStorage extends KeyValueEntityStorage implements Cont /** * {@inheritdoc} */ - public function createTranslation(TranslatableInterface $entity, $langcode, array $values = []) { + public function createTranslation(ContentEntityInterface $entity, $langcode, array $values = []) { // @todo Complete the content entity storage implementation in // https://www.drupal.org/node/2618436. } diff --git a/core/lib/Drupal/Core/Entity/TranslatableStorageInterface.php b/core/lib/Drupal/Core/Entity/TranslatableStorageInterface.php index 56c25f6408..2c99520d5b 100644 --- a/core/lib/Drupal/Core/Entity/TranslatableStorageInterface.php +++ b/core/lib/Drupal/Core/Entity/TranslatableStorageInterface.php @@ -10,7 +10,7 @@ /** * Constructs a new entity translation object, without permanently saving it. * - * @param \Drupal\Core\Entity\TranslatableInterface $entity + * @param \Drupal\Core\Entity\ContentEntityInterface $entity * The entity object being translated. * @param string $langcode * The translation language code. @@ -21,7 +21,10 @@ * @return \Drupal\Core\Entity\TranslatableInterface * Another instance of the specified entity object class with the specified * active language and initial values. + * + * @todo Consider accepting \Drupal\Core\Entity\TranslatableInterface as first + * parameter. See https://www.drupal.org/project/drupal/issues/2932049. */ - public function createTranslation(TranslatableInterface $entity, $langcode, array $values = []); + public function createTranslation(ContentEntityInterface $entity, $langcode, array $values = []); }