$min =
$rows[0
][$name . '.min'
] ?? null;
$max =
$rows[0
][$name . '.max'
] ?? null;
$avg =
isset($rows[0
][$name . '.avg'
]) ?
(float) $rows[0
][$name . '.avg'
] : null;
$sum =
isset($rows[0
][$name . '.sum'
]) ?
(float) $rows[0
][$name . '.sum'
] : null;
return new StatsResult($aggregation->
getName(),
$min,
$max,
$avg,
$sum);
case $aggregation instanceof EntityAggregation:
return $this->
hydrateEntityAggregation($aggregation,
$rows,
$context);
case $aggregation instanceof RangeAggregation:
return $this->
hydrateRangeAggregation($aggregation,
$rows);
default:
throw new InvalidAggregationQueryException(sprintf('Aggregation of type %s not supported',
$aggregation::
class));
} } /**
* @param array<array<string, mixed>> $rows
*/
private function hydrateEntityAggregation( EntityAggregation
$aggregation,
array
$rows,