You are here

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

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

Load All.

Return value

array An array of Bundles.

11 calls to Bundle::loadAll()
Bundle::loadByEntityType in ./eck.classes.inc
Load by entity type.
Bundle::loadByMachineName in ./eck.classes.inc
This method returns a bundle object.
eck_bundle_features_export_options in ./eck.features.inc
Implements hook_features_export_options().
eck_bundle_features_rebuild in ./eck.features.inc
Implements hook_features_rebuild().
eck_flush_caches in ./eck.module
Implements hook_flush_caches().

... See full list

File

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

Class

Bundle

Code

public static function loadAll($reset = FALSE) {
  $bundles = array();
  global $_eck_bundles_cache;
  $cache_enabled = isset($_eck_bundles_cache) ? TRUE : FALSE;
  if ($cache_enabled) {
    if ($reset) {
      $_eck_bundles_cache
        ->reset();
    }
    $bundles = $_eck_bundles_cache
      ->get();
  }
  if (empty($bundles)) {
    $bundles = array();

    // @todo move this to a general function.
    $results = db_select('eck_bundle', 't')
      ->fields('t', array(
      'machine_name',
    ))
      ->execute();
    foreach ($results as $result) {
      $name = $result->machine_name;
      $bundle = new Bundle();
      $bundle
        ->load('machine_name', $name);
      $bundles[$name] = $bundle;
    }
    if ($cache_enabled) {
      $_eck_bundles_cache
        ->set($bundles);
    }
  }
  return $bundles;
}