function EntityStorageBase::__construct

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::__construct()
  2. 10 core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::__construct()
  3. 11.x core/lib/Drupal/Core/Entity/EntityStorageBase.php \Drupal\Core\Entity\EntityStorageBase::__construct()

Constructs an EntityStorageBase instance.

Parameters

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

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

3 calls to EntityStorageBase::__construct()
ConfigEntityStorage::__construct in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Constructs a ConfigEntityStorage object.
ContentEntityStorageBase::__construct in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Constructs a ContentEntityStorageBase object.
KeyValueEntityStorage::__construct in core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
Constructs a new KeyValueEntityStorage.
3 methods override EntityStorageBase::__construct()
ConfigEntityStorage::__construct in core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php
Constructs a ConfigEntityStorage object.
ContentEntityStorageBase::__construct in core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php
Constructs a ContentEntityStorageBase object.
KeyValueEntityStorage::__construct in core/lib/Drupal/Core/Entity/KeyValueStore/KeyValueEntityStorage.php
Constructs a new KeyValueEntityStorage.

File

core/lib/Drupal/Core/Entity/EntityStorageBase.php, line 100

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

public function __construct(EntityTypeInterface $entity_type, MemoryCacheInterface $memory_cache) {
    $this->entityTypeId = $entity_type->id();
    $this->entityType = $entity_type;
    $this->baseEntityClass = $entity_type->getClass();
    $this->idKey = $this->entityType
        ->getKey('id');
    $this->uuidKey = $this->entityType
        ->getKey('uuid');
    $this->langcodeKey = $this->entityType
        ->getKey('langcode');
    $this->memoryCache = $memory_cache;
    $this->memoryCacheTag = 'entity.memory_cache:' . $this->entityTypeId;
}

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