You are here

public static function EntityType::loadAll in Entity Construction Kit (ECK) 7.3

Same name and namespace in other branches
  1. 7.2 eck.classes.inc \EntityType::loadAll()

Load all.

Return value

array An array of entity types keyed by entity type name.

30 calls to EntityType::loadAll()
drush_eck_entity_construction_kit in includes/eck.drush.inc
Implements drush_hook_command().
drush_eck_entity_construction_kit_all in includes/eck.drush.inc
Implements drush_hook_command().
eck_entitycache_entity_info_alter in modules/eck_entitycache/eck_entitycache.module
Implements hook_entity_info_alter().
eck_entitycache_flush_caches in modules/eck_entitycache/eck_entitycache.module
Implements hook_flush_caches().
eck_entitycache_schema in modules/eck_entitycache/eck_entitycache.install
Implements hook_schema().

... See full list

File

./eck.classes.inc, line 463
Classes for all the different objects used in ECK.

Class

EntityType

Code

public static function loadAll($reset = FALSE) {
  $entity_types = array();
  global $_eck_entity_types_cache;
  $cache_enabled = isset($_eck_entity_types_cache) ? TRUE : FALSE;
  if ($cache_enabled) {
    if ($reset) {
      $_eck_entity_types_cache
        ->reset();
    }
    $entity_types = $_eck_entity_types_cache
      ->get();
  }
  if (empty($entity_types)) {
    $entity_types = array();
    $results = db_select('eck_entity_type', 't')
      ->fields('t', array(
      'name',
    ))
      ->execute();
    foreach ($results as $result) {
      $name = $result->name;
      $entity_type = new EntityType();
      $entity_type
        ->load('name', $name);
      $entity_types[$name] = $entity_type;
    }
    if ($cache_enabled) {
      $_eck_entity_types_cache
        ->set($entity_types);
    }
  }
  return $entity_types;
}