You are here

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

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

Load all entity types.

Parameters

bool $reset: Use data from the cache, or not.

Return value

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

24 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_bundle_copy_info in ./eck.module
Implements hook_bundle_copy_info().
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().

... See full list

File

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

Class

EntityType
An entity type database object.

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;
}