function SqlContentEntityStorage::__construct

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

Constructs a SqlContentEntityStorage object.

Parameters

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

\Drupal\Core\Database\Connection $database: The database connection to be used.

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

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

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

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

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

\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.

Overrides ContentEntityStorageBase::__construct

1 call to SqlContentEntityStorage::__construct()
CommentStorage::__construct in core/modules/comment/src/CommentStorage.php
Constructs a CommentStorage object.
1 method overrides SqlContentEntityStorage::__construct()
CommentStorage::__construct in core/modules/comment/src/CommentStorage.php
Constructs a CommentStorage object.

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 198

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

public function __construct(EntityTypeInterface $entity_type, Connection $database, EntityFieldManagerInterface $entity_field_manager, CacheBackendInterface $cache, LanguageManagerInterface $language_manager, MemoryCacheInterface $memory_cache = NULL, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, EntityTypeManagerInterface $entity_type_manager = NULL) {
    parent::__construct($entity_type, $entity_field_manager, $cache, $memory_cache, $entity_type_bundle_info);
    $this->database = $database;
    $this->languageManager = $language_manager;
    if (!$entity_type_manager) {
        @trigger_error('Calling SqlContentEntityStorage::__construct() with the $entity_type_manager 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_manager = \Drupal::entityTypeManager();
    }
    $this->entityTypeManager = $entity_type_manager;
    $this->entityType = $this->entityTypeManager
        ->getActiveDefinition($entity_type->id());
    $this->fieldStorageDefinitions = $this->entityFieldManager
        ->getActiveFieldStorageDefinitions($entity_type->id());
    $this->initTableLayout();
}

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