getGroupIds example

if (!isset($elasticResult['aggregations']['properties'])) {
            return;
        }

        $data = $elasticResult['aggregations']['properties']['buckets'];
        $ids = array_column($data, 'key');

        if (empty($ids)) {
            return;
        }

        $groupIds = $this->getGroupIds($ids);

        $search = new EsSearch();
        $search->addQuery(new IdsQuery($groupIds), BoolQuery::FILTER);
        $search->addQuery(new TermQuery('filterable', true), BoolQuery::FILTER);
        $search->addSort(new FieldSort('name', 'asc'));
        $search->setFrom(0);
        $search->setSize(self::AGGREGATION_SIZE);

        $index = $this->indexFactory->createShopIndex($context->getShop(), PropertyMapping::TYPE);

        $arguments = [
            
foreach ($currencies as $currency) {
                $contexts[] = $this->contextService->createShopContext($shopId$currency$customerGroup);
            }
        }

        return $contexts;
    }

    private function getFilteredGroups(array $configuration, VariantFacet $variantFacet): array
    {
        return array_filter(array_map(static function DGroup $group) use ($variantFacet) {
            if (!\in_array($group->getId()$variantFacet->getGroupIds(), true)) {
                return null;
            }

            return $group->getId();
        }$configuration));
    }
}
if (!$facet instanceof VariantFacet) {
            return;
        }

        $ids = array_column($buckets, 'key');
        $groups = $this->gateway->getOptions($ids$context);
        if (empty($groups)) {
            return;
        }

        $groups = array_filter($groupsfunction DGroup $group) use ($facet) {
            return \in_array($group->getId()$facet->getGroupIds(), true);
        });

        $actives = $this->getFilteredValues($criteria);
        $facet = $this->createCollectionResult($facet$groups$actives);
        $result->addFacet($facet);
    }

    /** * @param Group[] $groups * @param int[] $actives */
    
$attributes['core']->set($columnName$value);
            }
        }

        return $attributes;
    }

    private function neededToIndex(array $groups, VariantFacet $variantFacet): bool
    {
        foreach ($groups as $group) {
            if (\in_array($group$variantFacet->getGroupIds(), true)) {
                return true;
            }
        }

        return false;
    }
}
return $this->createCollectionResult($facet$options$actives);
    }

    /** * @deprecated - Will be private with Shopware 5.8 * * @return Group[]|null */
    protected function getOptions(ShopContextInterface $context, Criteria $queryCriteria, VariantFacet $facet)
    {
        if (empty($facet->getGroupIds())) {
            return null;
        }

        $query = $this->queryBuilderFactory->createQuery($queryCriteria$context);
        $this->rebuildQuery($queryCriteria$query$facet);

        $valueIds = $query->execute()->fetchAll(PDO::FETCH_COLUMN);

        if (empty($valueIds)) {
            return null;
        }

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