protected function TripalFieldQuery::queryStorageCallback

3.x TripalFieldQuery.inc protected TripalFieldQuery::queryStorageCallback($storage)

Determines the query callback to use for this entity query.

This function is a replacement for queryCallback() from the parent EntityFieldQuery class because that class only allows a single storage type per query.

Parameters

$storage: The storage module

Return value

A callback that can be used with call_user_func().

Throws

EntityFieldQueryException

1 call to TripalFieldQuery::queryStorageCallback()
TripalFieldQuery::execute in tripal/includes/TripalFieldQuery.inc
Overrides the EntityFieldQuery::execute() function.

File

tripal/includes/TripalFieldQuery.inc, line 96

Class

TripalFieldQuery
Extends the EntityFieldQuery to support queries from multiple storage types.

Code

protected function queryStorageCallback($storage) {
  // 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 ($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."));
  }
}