function KeyValueEntityStorage::__construct

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::__construct()
  2. 10 core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php \Drupal\Core\Entity\KeyValueStore\KeyValueEntityStorage::__construct()
  3. 11.x 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');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.