fetchAggregation example

private readonly EntityScoreQueryBuilder $scoreBuilder
    ) {
    }

    public function aggregate(
        EntityDefinition $definition,
        Criteria $criteria,
        Context $context
    ): AggregationResultCollection {
        $aggregations = new AggregationResultCollection();
        foreach ($criteria->getAggregations() as $aggregation) {
            $result = $this->fetchAggregation($aggregation$definition$criteria$context);
            $aggregations->add($result);
        }

        return $aggregations;
    }

    public static function formatDate(string $interval, \DateTime $date): string
    {
        switch ($interval) {
            case DateHistogramAggregation::PER_MINUTE:
                return $date->format('Y-m-d H:i:00');
            
Home | Imprint | This part of the site doesn't use cookies.