public function EntityFieldQuery::queryCallback

7.x entity.inc public EntityFieldQuery::queryCallback()

Determines the query callback to use for this entity query.

Return value

A callback that can be used with call_user_func().

1 call to EntityFieldQuery::queryCallback()
EntityFieldQuery::execute in drupal-7.x/includes/entity.inc
Executes the query.

File

drupal-7.x/includes/entity.inc, line 1151

Class

EntityFieldQuery
Retrieves entities matching a given set of conditions.

Code

public function queryCallback() {
  // Use the override from $this->executeCallback. It can be set either
  // while building the query, or using hook_entity_query_alter().
  if (function_exists($this->executeCallback)) {
    return $this->executeCallback;
  }
  // If there are no field conditions and sorts, and no execute callback
  // then we default to querying entity tables in SQL.
  if (empty($this->fields)) {
    return array($this, 'propertyQuery');
  }
  // If no override, find the storage engine to be used.
  foreach ($this->fields as $field) {
    if (!isset($storage)) {
      $storage = $field['storage']['module'];
    }
    elseif ($storage != $field['storage']['module']) {
      throw new EntityFieldQueryException(t("Can't handle more than one field storage engine"));
    }
  }
  if ($storage) {
    // Use hook_field_storage_query() from the field storage.
    return $storage . '_field_storage_query';
  }
  else {
    throw new EntityFieldQueryException(t("Field storage engine not found."));
  }
}