2.2.0 (latest) 2.0.6 1.34.2 1.33.1 1.32.3 1.31.0 1.30.0 1.29.2 1.28.2 1.26.0 1.25.0 1.24.4 1.23.0 1.22.1 1.21.2 1.19.0 1.18.1 1.17.1 Reference documentation and code samples for the Cloud Datastore Client class AggregationQueryResult.

Represents the result of an [Aggregation Query](https://cloud.google.com/datastore/docs/aggregation-queries)

Example:

    use Google\Cloud\Datastore\DatastoreClient;

    $datastore = new DatastoreClient();

    $query = $datastore->AggregationQuery();
    $query->kind('Companies');
    $query->filter('companyName', '=', 'Google');
    $query->limit(100);
    $query->addAggregation(Aggregation::count()->alias('total_upto_100'));

    $res = $datastore->runAggregationQuery($query);
    echo $res->get('total_upto_100');

## Namespace

Google \\ Cloud \\ Datastore \\ Query

## Methods

### __construct

Create AggregationQueryResult object.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `result` | `array` Response of [RunAggregationQuery](https://cloud.google.com/datastore/docs/reference/data/rest/v1/projects/runAggregationQuery) |
| `mapper` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/EntityMapper` \[Optional\] Entity mapper to map datastore values to their equivalent php values incase of `null`, `NAN`, `INF` and `-INF` |

### get

Get the Query Aggregation value.

Example:

    $query = $datastore->AggregationQuery();
    $query->kind('Companies');
    $query->filter('companyName', '=', 'Google');
    $query->addAggregation(Aggregation::count()->alias('total'));
    $res = $client->runAggregationQuery($query);
    echo $res->get('total');

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `alias` | `string` The aggregation alias. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `mixed` |   |

### getQuery

Gets the value of query for example in case of a GqlQuery.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/Query.AggregationQuery|null` |   |

### getTransaction

Gets the transaction id when Aggregation is associated with a Transaction.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string|null` |   |

### getReadTime

Gets the timestamp when Aggregation was executed.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-core/latest/Timestamp.html` |   |

### getExplainMetrics

Gets the ExplainMetrics object if the explainOptions parameter was set for
the query

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `null|https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.ExplainMetrics` |   |