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:
return new MinResult($aggregation->
getName(),
$result['value'
]);
case $aggregation instanceof SumAggregation:
return new SumResult($aggregation->
getName(),
$result['value'
]);
case $aggregation instanceof FilterAggregation:
$nested =
$aggregation->
getAggregation();
if (!
$nested) { throw new \
RuntimeException(sprintf('Filter aggregation %s contains no nested aggregation.',
$aggregation->
getName()));
} $nestedResult =
$result;
while (isset($nestedResult[$aggregation->
getName()])) { $nestedResult =
$nestedResult[$aggregation->
getName()];
}