X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FEntity%2FKeyValueStore%2FKeyValueEntityStorage.php;h=113f6307873bdc37d52959d1345f7a6735795704;hb=5b8bb166bfa98770daef9de5c127fc2e6ef02340;hp=de77e09d20f3ac94492900e3a65516592e1fdb1b;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php b/web/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php index de77e09d2..113f63078 100644 --- a/web/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php +++ b/web/core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php @@ -3,6 +3,7 @@ namespace Drupal\Core\Entity\KeyValueStore; use Drupal\Component\Uuid\UuidInterface; +use Drupal\Core\Cache\MemoryCache\MemoryCacheInterface; use Drupal\Core\Config\Entity\Exception\ConfigEntityIdLengthException; use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Entity\EntityInterface; @@ -60,9 +61,11 @@ class KeyValueEntityStorage extends EntityStorageBase { * The UUID service. * @param \Drupal\Core\Language\LanguageManagerInterface $language_manager * The language manager. + * @param \Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memory_cache + * The memory cache. */ - public function __construct(EntityTypeInterface $entity_type, KeyValueStoreInterface $key_value_store, UuidInterface $uuid_service, LanguageManagerInterface $language_manager) { - parent::__construct($entity_type); + public function __construct(EntityTypeInterface $entity_type, KeyValueStoreInterface $key_value_store, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache = NULL) { + parent::__construct($entity_type, $memory_cache); $this->keyValueStore = $key_value_store; $this->uuidService = $uuid_service; $this->languageManager = $language_manager; @@ -79,7 +82,8 @@ class KeyValueEntityStorage extends EntityStorageBase { $entity_type, $container->get('keyvalue')->get('entity_storage__' . $entity_type->id()), $container->get('uuid'), - $container->get('language_manager') + $container->get('language_manager'), + $container->get('entity.memory_cache') ); } @@ -187,6 +191,13 @@ class KeyValueEntityStorage extends EntityStorageBase { return $this->keyValueStore->has($id); } + /** + * {@inheritdoc} + */ + public function hasData() { + return (bool) $this->keyValueStore->getAll(); + } + /** * {@inheritdoc} */