JoinGroupBuilder example

$definition = $registry->get(ProductDefinition::class);

        $filters = [
            new EqualsFilter('active', true),
            new MultiFilter(MultiFilter::CONNECTION_AND, [
                new EqualsFilter('stock', 10),
                new EqualsFilter('categories.type', 'test'),
            ]),
            new MultiFilter(MultiFilter::CONNECTION_OR),
        ];

        $builder = new JoinGroupBuilder();
        $groupedFilters = $builder->group($filters$definition['product.categories']);

        static::assertCount(3, $groupedFilters);
        static::assertInstanceOf(EqualsFilter::class$groupedFilters[0]);
        static::assertInstanceOf(EqualsFilter::class$groupedFilters[1]);
        static::assertInstanceOf(JoinGroup::class$groupedFilters[2]);
    }
}
Home | Imprint | This part of the site doesn't use cookies.