CriteriaArrayConverter example

new ProductPriceDefinition(),
                new ProductCategoryDefinition(),
                new CategoryDefinition(),
            ],
            $this->createMock(ValidatorInterface::class),
            $this->createMock(EntityWriteGatewayInterface::class)
        );

        $this->requestCriteriaBuilder = new RequestCriteriaBuilder(
            $aggregationParser,
            new ApiCriteriaValidator($this->staticDefinitionRegistry),
            new CriteriaArrayConverter($aggregationParser),
        );
    }

    /** * @return iterable<string, array{int|null, int|null, int|null, bool}> */
    public static function maxApiLimitProvider(): iterable
    {
        yield 'Test null max limit' => [10000, null, 10000, false];
        yield 'Test null max limit and null limit' => [null, null, null, false];
        yield 'Test max limit with null limit' => [null, 100, 100, false];
        
$ids = array_filter($ids);
        if (empty($ids)) {
            throw DataAbstractionLayerException::invalidCriteriaIds($ids, 'Ids should not be empty');
        }
        $this->validateIds($ids);

        $this->ids = $ids;
    }

    public function __toString(): string
    {
        $parsed = (new CriteriaArrayConverter(new AggregationParser()))->convert($this);

        return Json::encode($parsed);
    }

    /** * @return array<string>|array<array<string, string>> */
    public function getIds(): array
    {
        return $this->ids;
    }

    
Home | Imprint | This part of the site doesn't use cookies.