You are here

protected function EntityAPIController::buildQuery in Entity API 7

Overrides DrupalDefaultEntityController::buildQuery().

Overrides DrupalDefaultEntityController::buildQuery

2 calls to EntityAPIController::buildQuery()
EntityAPIController::query in includes/entity.controller.inc
Builds and executes the query for loading.
EntityAPIControllerExportable::buildQuery in includes/entity.controller.inc
Support loading by name key.
1 method overrides EntityAPIController::buildQuery()
EntityAPIControllerExportable::buildQuery in includes/entity.controller.inc
Support loading by name key.

File

includes/entity.controller.inc, line 174
Provides a controller building upon the core controller but providing more features like full CRUD functionality.

Class

EntityAPIController
A controller implementing EntityAPIControllerInterface for the database.

Code

protected function buildQuery($ids, $conditions = array(), $revision_id = FALSE) {
  $query = parent::buildQuery($ids, $conditions, $revision_id);
  if ($this->revisionKey) {

    // Compare revision id of the base and revision table, if equal then this
    // is the default revision.
    $query
      ->addExpression('CASE WHEN base.' . $this->revisionKey . ' = revision.' . $this->revisionKey . ' THEN 1 ELSE 0 END', $this->defaultRevisionKey);
  }
  return $query;
}