QueryAggregateInterface
interface QueryAggregateInterface implements QueryInterface (View source)
Defines a interface for aggregated entity queries.
Methods
Add a condition to the query or a condition group.
Queries for a non-empty value on a field.
Executes the aggregate query.
Creates a new group of conditions ANDed together.
Creates a new group of conditions ORed together.
Specifies a field and a function to aggregate on.
Specifies the field to group on.
Sets a condition for an aggregated value.
Queries for the existence of a field.
Queries for the nonexistence of a field.
Creates an object holding a group of conditions.
Sorts by an aggregated value.
Details
$this
addTag($tag)
Adds a tag to a query.
Tags are strings that identify a query. A query may have any number of tags. Tags are used to mark a query so that alter hooks may decide if they wish to take action. Tags should be all lower-case and contain only letters, numbers, and underscore, and start with a letter. That is, they should follow the same rules as PHP identifiers in general.
true
hasTag($tag)
Determines if a given query has a given tag.
true
hasAllTags()
Determines if a given query has all specified tags.
Each tag to check should be supplied as a separate argument.
true
hasAnyTag()
Determines if a given query has any specified tag.
Each tag to check should be supplied as a separate argument.
$this
addMetaData($key, $object)
Adds additional metadata to the query.
Often, a query may need to provide additional contextual data to alter hooks. Alter hooks may then use that information to decide if and how to take action.
The
getMetaData($key)
Retrieves a given piece of metadata.
string
getEntityTypeId()
Gets the ID of the entity type for this query.
$this
condition($field, $value = NULL, $operator = NULL, $langcode = NULL)
Add a condition to the query or a condition group.
For example, to find all entities containing both the Turkish 'merhaba' and the Polish 'siema' within a 'greetings' text field:
$this
exists($field, $langcode = NULL)
Queries for a non-empty value on a field.
$this
notExists($field, $langcode = NULL)
Queries for an empty field.
$this
pager($limit = 10, $element = NULL)
Enables a pager for the query.
$this
range(null $start = NULL, null $length = NULL)
No description
$this
sort($field, string $direction = 'ASC', $langcode = NULL)
No description
$this
count()
Makes this a count query.
For count queries, execute() returns the number entities found.
$this
tableSort($headers)
Enables sortable tables for this query.
$this
accessCheck($access_check = TRUE)
No description
int|array
execute()
Executes the aggregate query.
ConditionInterface
andConditionGroup()
Creates a new group of conditions ANDed together.
For example, consider a drawing entity type with a 'figures' multi-value field containing 'shape' and 'color' columns. To find all drawings containing both a red triangle and a blue circle:
ConditionInterface
orConditionGroup()
Creates a new group of conditions ORed together.
For example, consider a map entity with an 'attributes' field containing 'building_type' and 'color' columns. To find all green and red bikesheds:
$this
currentRevision()
Queries the current revision.
$this
latestRevision()
Queries the latest revision.
The latest revision is the most recent revision of an entity. This will be either the default revision, or a pending revision if one exists and it is newer than the default.
$this
allRevisions()
Queries all the revisions.
$this
aggregate(string $field, string $function, string $langcode = NULL, string $alias = NULL)
Specifies a field and a function to aggregate on.
Available functions: SUM, AVG, MIN, MAX and COUNT.
$this
groupBy(string $field)
Specifies the field to group on.
$this
conditionAggregate(string $field, string $function = NULL, mixed $value = NULL, $operator = '=', string $langcode = NULL)
Sets a condition for an aggregated value.
$this
existsAggregate(string $field, string $function, $langcode = NULL)
Queries for the existence of a field.
$this
notExistsAggregate(string $field, string $function, string $langcode = NULL)
Queries for the nonexistence of a field.
ConditionInterface
conditionAggregateGroupFactory(string $conjunction = 'AND')
Creates an object holding a group of conditions.
See andConditionAggregateGroup() and orConditionAggregateGroup() for more.
$this
sortAggregate(string $field, string $function, string $direction = 'ASC', string $langcode = NULL)
Sorts by an aggregated value.