public function DatabaseStorageController::__construct

Constructs a DatabaseStorageController object.

Parameters

string $entityType: The entity type for which the instance is created.

1 call to DatabaseStorageController::__construct()
DatabaseStorageControllerNG::__construct in drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
Overrides DatabaseStorageController::__construct().
1 method overrides DatabaseStorageController::__construct()
DatabaseStorageControllerNG::__construct in drupal/core/lib/Drupal/Core/Entity/DatabaseStorageControllerNG.php
Overrides DatabaseStorageController::__construct().

File

drupal/core/lib/Drupal/Core/Entity/DatabaseStorageController.php, line 115
Definition of Drupal\Core\Entity\DatabaseStorageController.

Class

DatabaseStorageController
Defines a base entity controller class.

Namespace

Drupal\Core\Entity

Code

public function __construct($entityType) {
  $this->entityType = $entityType;
  $this->entityInfo = entity_get_info($entityType);
  $this->entityCache = array();
  $this->hookLoadArguments = array();
  $this->idKey = $this->entityInfo['entity_keys']['id'];

  // Check if the entity type supports UUIDs.
  if (!empty($this->entityInfo['entity_keys']['uuid'])) {
    $this->uuidKey = $this->entityInfo['entity_keys']['uuid'];
  }
  else {
    $this->uuidKey = FALSE;
  }

  // Check if the entity type supports revisions.
  if (!empty($this->entityInfo['entity_keys']['revision'])) {
    $this->revisionKey = $this->entityInfo['entity_keys']['revision'];
    $this->revisionTable = $this->entityInfo['revision_table'];
  }
  else {
    $this->revisionKey = FALSE;
  }

  // Check if the entity type supports static caching of loaded entities.
  $this->cache = !empty($this->entityInfo['static_cache']);
}