function entity_get_controller

7.x common.inc entity_get_controller($entity_type)
8.x entity.inc entity_get_controller($entity_type)

Gets the entity controller for an entity type.

Return value

DrupalEntityControllerInterface The entity controller object for the specified entity type.

17 calls to entity_get_controller()
entity_load in drupal/includes/common.inc
Load entities from the database.
entity_load_unchanged in drupal/includes/common.inc
Loads the unchanged, i.e. not modified, entity from the database.
FileFieldTestCase::assertFileEntryExists in drupal/modules/file/tests/file.test
Asserts that a file exists in the database.
FileFieldTestCase::assertFileEntryNotExists in drupal/modules/file/tests/file.test
Asserts that a file does not exist in the database.
file_delete in drupal/includes/file.inc
Deletes a file and its database record.

... See full list

File

drupal/includes/common.inc, line 7880
Common functions that many Drupal modules will need to reference.

Code

function entity_get_controller($entity_type) {
  $controllers = &drupal_static(__FUNCTION__, array());
  if (!isset($controllers[$entity_type])) {
    $type_info = entity_get_info($entity_type);
    $class = $type_info['controller class'];
    $controllers[$entity_type] = new $class($entity_type);
  }
  return $controllers[$entity_type];
}