return $aggregations;
} private function hydrateAggregation(Aggregation
$aggregation, array
$result, Context
$context): ?AggregationResult
{ switch (true
) { case $aggregation instanceof StatsAggregation:
return new StatsResult($aggregation->
getName(),
$result['min'
],
$result['max'
],
$result['avg'
],
$result['sum'
]);
case $aggregation instanceof AvgAggregation:
return new AvgResult($aggregation->
getName(),
$result['value'
]);
case $aggregation instanceof CountAggregation:
return new CountResult($aggregation->
getName(),
$result['value'
]);
case $aggregation instanceof EntityAggregation:
return $this->
hydrateEntityAggregation($aggregation,
$result,
$context);
case $aggregation instanceof MaxAggregation:
return new MaxResult($aggregation->
getName(),
$result['value'
]);
case $aggregation instanceof MinAggregation: