FilterCollection example

if (!$filters instanceof FilterCollection) {
            return;
        }

        foreach ($filters as $filter) {
            $result->addCurrentFilter($filter->getName()$filter->getValues());
        }
    }

    private function getFilters(Request $request, SalesChannelContext $context): FilterCollection
    {
        $filters = new FilterCollection();

        foreach ($this->factories as $factory) {
            $filter = $factory->create($request$context);

            if ($filter !== null) {
                $filters->add($filter);
            }
        }

        $event = new ProductListingCollectFilterEvent($request$filters$context);
        $this->dispatcher->dispatch($event);

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