You are here

public function EntityFieldQuery::entityOrderBy in Drupal 7

Orders the result set by entity-generic metadata.

If called multiple times, the query will order by each specified column in the order this method is called.

Note: The "comment" and "taxonomy_term" entity types don't support ordering by bundle. For "taxonomy_term", propertyOrderBy('vid') can be used instead.

Parameters

$name: 'entity_type', 'bundle', 'revision_id' or 'entity_id'.

$direction: The direction to sort. Legal values are "ASC" and "DESC".

Return value

EntityFieldQuery The called object.

File

includes/entity.inc, line 922

Class

EntityFieldQuery
Retrieves entities matching a given set of conditions.

Code

public function entityOrderBy($name, $direction = 'ASC') {
  $this->order[] = array(
    'type' => 'entity',
    'specifier' => $name,
    'direction' => $direction,
  );
  return $this;
}