public function DrupalDefaultEntityController::__construct in Drupal 7
Constructor: sets basic variables.
Parameters
$entityType: The entity type for which the instance is created.
File
- includes/
entity.inc, line 120
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']);
}