public function EntityFieldQuery::queryCallback

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

includes/entity.inc, line 1227

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

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!entity.inc/function/EntityFieldQuery::queryCallback/7.x