You are here

protected function OrganigramsItemController::cacheGet in Organigrams 7

Gets entities from the static cache.

Parameters

array $ids: An array of entity IDs, or FALSE to load all entities.

array $conditions: An array of conditions in the form 'field' => $value.

Return value

array Array of entities from the entity cache.

Overrides DrupalDefaultEntityController::cacheGet

File

./organigrams.module, line 2159
Defines the organigrams functions and entity types.

Class

OrganigramsItemController
Controller class for organigrams items.

Code

protected function cacheGet($ids, $conditions = array()) {
  $organigrams_items = parent::cacheGet($ids, $conditions);

  // Name matching is case insensitive, note that with some collations
  // LOWER() and drupal_strtolower() may return different results.
  foreach ($organigrams_items as $organigrams_item) {

    // Convert organigrams item to an array.
    $organigrams_item_values = (array) $organigrams_item;

    // Remove any mismatching names.
    if (isset($conditions['name']) && drupal_strtolower($conditions['name'] != drupal_strtolower($organigrams_item_values['name']))) {

      // Remove the organigrams item.
      unset($organigrams_items[$organigrams_item->iid]);
    }
  }
  return $organigrams_items;
}