1 entity.query.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().:

File

core/modules/entity/entity.query.inc, line 785
Entity query API.

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."));
  }
}