You are here

public function ContentEntityStorageBase::__construct in Drupal 8

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

Constructs a ContentEntityStorageBase object.

Parameters

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

\Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager: The entity field manager.

\Drupal\Core\Cache\CacheBackendInterface $cache: The cache backend to be used.

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

\Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info: The entity type bundle info.

Overrides EntityStorageBase::__construct

1 call to ContentEntityStorageBase::__construct()
SqlContentEntityStorage::__construct in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Constructs a SqlContentEntityStorage object.
2 methods override ContentEntityStorageBase::__construct()
SqlContentEntityStorage::__construct in core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php
Constructs a SqlContentEntityStorage object.
TestContentEntityStorageBase::__construct in core/tests/Drupal/Tests/Core/Entity/LegacyContentEntityStorageBaseTest.php
Constructs a TestContentEntityStorageBase object.

File

core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php, line 75

Class

ContentEntityStorageBase
Base class for content entity storage handlers.

Namespace

Drupal\Core\Entity

Code

public function __construct(EntityTypeInterface $entity_type, EntityFieldManagerInterface $entity_field_manager, CacheBackendInterface $cache, MemoryCacheInterface $memory_cache = NULL, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL) {
  parent::__construct($entity_type, $memory_cache);
  $this->bundleKey = $this->entityType
    ->getKey('bundle');
  $this->entityFieldManager = $entity_field_manager;
  $this->cacheBackend = $cache;
  if (!$entity_type_bundle_info) {
    @trigger_error('Calling ContentEntityStorageBase::__construct() with the $entity_type_bundle_info argument is supported in drupal:8.7.0 and will be required before drupal:9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
    $entity_type_bundle_info = \Drupal::service('entity_type.bundle.info');
  }
  $this->entityTypeBundleInfo = $entity_type_bundle_info;
}