parseRangeFilter example

public function parseFilter(Filter $filter, EntityDefinition $definition, string $root, Context $context): BuilderInterface
    {
        return match (true) {
            $filter instanceof NotFilter => $this->parseNotFilter($filter$definition$root$context),
            $filter instanceof MultiFilter => $this->parseMultiFilter($filter$definition$root$context),
            $filter instanceof EqualsFilter => $this->parseEqualsFilter($filter$definition$context),
            $filter instanceof EqualsAnyFilter => $this->parseEqualsAnyFilter($filter$definition$context),
            $filter instanceof ContainsFilter => $this->parseContainsFilter($filter$definition$context),
            $filter instanceof PrefixFilter => $this->parsePrefixFilter($filter$definition$context),
            $filter instanceof SuffixFilter => $this->parseSuffixFilter($filter$definition$context),
            $filter instanceof RangeFilter => $this->parseRangeFilter($filter$definition$context),
            default => throw new \RuntimeException(sprintf('Unsupported filter %s', $filter::class)),
        };
    }

    protected function parseFilterAggregation(FilterAggregation $aggregation, EntityDefinition $definition, Context $context): AbstractAggregation
    {
        if ($aggregation->getAggregation() === null) {
            throw new \RuntimeException(sprintf('Filter aggregation %s contains no nested aggregation.', $aggregation->getName()));
        }

        $nested = $this->parseAggregation($aggregation->getAggregation()$definition$context);
        
$result->addWhere((string) $query->getResolved());

            return $result;
        }

        return match (true) {
            $query instanceof EqualsFilter => $this->parseEqualsFilter($query$definition$root$context$negated),
            $query instanceof EqualsAnyFilter => $this->parseEqualsAnyFilter($query$definition$root$context),
            $query instanceof ContainsFilter => $this->parseContainsFilter($query$definition$root$context),
            $query instanceof PrefixFilter => $this->parsePrefixFilter($query$definition$root$context),
            $query instanceof SuffixFilter => $this->parseSuffixFilter($query$definition$root$context),
            $query instanceof RangeFilter => $this->parseRangeFilter($query$definition$root$context),
            $query instanceof NotFilter => $this->parseNotFilter($query$definition$root$context),
            $query instanceof MultiFilter => $this->parseMultiFilter($query$definition$root$context$negated),
            default => throw new \RuntimeException(sprintf('Unsupported query %s', $query::class)),
        };
    }

    private function parseRangeFilter(
        RangeFilter $query,
        EntityDefinition $definition,
        string $root,
        Context $context
    ):
Home | Imprint | This part of the site doesn't use cookies.