diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index 9ab9c56..c9d5d98 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -1044,35 +1044,6 @@ protected function getEntityKey($key) { /** * {@inheritdoc} */ - public function getCacheData() { - // Start with all the values, so that the data will also include values - // which are not defined as fields. - // @todo: Remove support for this when all entity values are fields. - $data = $this->values; - $default_langcode = $this->getUntranslated()->language()->id; - foreach ($this->getTranslationLanguages() as $langcode => $language) { - $translation = $this->getTranslation($langcode); - // Make sure the default language is valid. - if ($default_langcode == $langcode) { - $langcode = Language::LANGCODE_DEFAULT; - } - foreach ($translation as $field_name => $items) { - if (!$items->isEmpty()) { - // Remove existing values for defined fields, so that their - // structure is standardized. - if (isset($data[$field_name][$langcode])) { - unset($data[$field_name][$langcode]); - } - $data[$field_name][$langcode] = $items->getValue(); - } - } - } - return $data; - } - - /** - * {@inheritdoc} - */ public static function bundleFieldDefinitions(EntityTypeInterface $entity_type, $bundle, array $base_field_definitions) { return array(); } diff --git a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php index f8c5c47..f40774c 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityDatabaseStorage.php @@ -204,14 +204,11 @@ protected function getFromPersistentCache(&$ids) { $cids[] = $this->buildCacheId($id); } if ($cache = $this->cacheBackend->getMultiple($cids)) { - // Create entity objects based on the loaded values from the cache. + // Get the entities that were found from the cache. foreach ($ids as $index => $id) { $cid = $this->buildCacheId($id); if (isset($cache[$cid])) { - $values = $cache[$cid]->data['values']; - $translations = $cache[$cid]->data['translations']; - $bundle = $this->bundleKey ? $cache[$cid]->data['bundle'] : FALSE; - $entities[$id] = new $this->entityClass($values, $this->entityTypeId, $bundle, $translations); + $entities[$id] = $cache[$cid]->data; unset($ids[$index]); } } @@ -231,13 +228,7 @@ protected function setPersistentCache($entities) { } foreach ($entities as $id => $entity) { - $data = array( - 'id' => $entity->id(), - 'bundle' => $entity->bundle(), - 'translations' => array_keys($entity->getTranslationLanguages()), - 'values' => $entity->getCacheData(), - ); - $this->cacheBackend->set($this->buildCacheId($id), $data, CacheBackendInterface::CACHE_PERMANENT, array($this->entityTypeId . '_values' => TRUE, 'entity_field_info' => TRUE)); + $this->cacheBackend->set($this->buildCacheId($id), $entity, CacheBackendInterface::CACHE_PERMANENT, array($this->entityTypeId . '_values' => TRUE, 'entity_field_info' => TRUE)); } }