You are here

protected function EntityAPIControllerExportable::cacheGetByName in Entity API 7

Like cacheGet() but keyed by name.

1 call to EntityAPIControllerExportable::cacheGetByName()
EntityAPIControllerExportable::load in includes/entity.controller.inc
Overridden to support passing numeric ids as well as names as $ids.

File

includes/entity.controller.inc, line 789
Provides a controller building upon the core controller but providing more features like full CRUD functionality.

Class

EntityAPIControllerExportable
A controller implementing exportables stored in the database.

Code

protected function cacheGetByName($names, $conditions = array()) {
  if (!empty($this->entityCacheByName) && $names !== array() && $names) {

    // First get the entities by ids, then apply the conditions.
    // Generally, we make use of $this->entityCache, but if we are loading by
    // name, we have to use $this->entityCacheByName.
    $entities = array_intersect_key($this->entityCacheByName, array_flip($names));
    return $this
      ->applyConditions($entities, $conditions);
  }
  return array();
}