You are here

public function EntityStorageBase::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 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|null $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 91

Class

EntityStorageBase
A base entity storage class.

Namespace

Drupal\Core\Entity

Code

public function __construct(EntityTypeInterface $entity_type, MemoryCacheInterface $memory_cache = NULL) {
  $this->entityTypeId = $entity_type
    ->id();
  $this->entityType = $entity_type;
  $this->idKey = $this->entityType
    ->getKey('id');
  $this->uuidKey = $this->entityType
    ->getKey('uuid');
  $this->langcodeKey = $this->entityType
    ->getKey('langcode');
  $this->entityClass = $this->entityType
    ->getClass();
  if (!isset($memory_cache)) {
    @trigger_error('The $memory_cache parameter was added in Drupal 8.6.x and will be required in 9.0.0. See https://www.drupal.org/node/2973262', E_USER_DEPRECATED);
    $memory_cache = \Drupal::service('entity.memory_cache');
  }
  $this->memoryCache = $memory_cache;
  $this->memoryCacheTag = 'entity.memory_cache:' . $this->entityTypeId;
}