You are here

public function KeyValueEntityStorage::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::__construct()

Constructs a new KeyValueEntityStorage.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

\Drupal\Core\KeyValueStore\KeyValueStoreInterface $key_value_store: The key value store.

\Drupal\Component\Uuid\UuidInterface $uuid_service: The UUID service.

\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager.

\Drupal\Core\Cache\MemoryCache\MemoryCacheInterface $memory_cache: The memory cache.

Overrides EntityStorageBase::__construct

File

core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php, line 67

Class

KeyValueEntityStorage
Provides a key value backend for entities.

Namespace

Drupal\Core\Entity\KeyValueStore

Code

public function __construct(EntityTypeInterface $entity_type, KeyValueStoreInterface $key_value_store, UuidInterface $uuid_service, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache) {
  parent::__construct($entity_type, $memory_cache);
  $this->keyValueStore = $key_value_store;
  $this->uuidService = $uuid_service;
  $this->languageManager = $language_manager;

  // Check if the entity type supports UUIDs.
  $this->uuidKey = $this->entityType
    ->getKey('uuid');
}