public function DrupalDefaultEntityController::__construct

7.x entity.inc public DrupalDefaultEntityController::__construct($entityType)

Constructor: sets basic variables.

Parameters

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

File

drupal-7.x/includes/entity.inc, line 118

Class

DrupalDefaultEntityController
Default implementation of DrupalEntityControllerInterface.

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 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']);
}