本文整理汇总了PHP中Pim\Bundle\CatalogBundle\Repository\ProductRepositoryInterface::getEligibleProductIdsForVariantGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductRepositoryInterface::getEligibleProductIdsForVariantGroup方法的具体用法?PHP ProductRepositoryInterface::getEligibleProductIdsForVariantGroup怎么用?PHP ProductRepositoryInterface::getEligibleProductIdsForVariantGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pim\Bundle\CatalogBundle\Repository\ProductRepositoryInterface
的用法示例。
在下文中一共展示了ProductRepositoryInterface::getEligibleProductIdsForVariantGroup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareParameters
/**
* @return array
*/
protected function prepareParameters()
{
$queryParameters = parent::prepareParameters();
$variantGroupId = $queryParameters['currentGroup'];
if (null !== $variantGroupId) {
$productIds = $this->productRepository->getEligibleProductIdsForVariantGroup($variantGroupId);
if (count($productIds) === 0) {
$productIds = [0];
}
} else {
$productIds = [0];
}
$queryParameters['productIds'] = $productIds;
return $queryParameters;
}
示例2: execute
/**
* @param array $configuration
*/
public function execute(array $configuration)
{
$actions = $configuration['actions'];
$variantGroupCode = $actions['value'];
$variantGroup = $this->groupRepository->findOneByIdentifier($variantGroupCode);
$axisAttributeCodes = $this->getAxisAttributeCodes($variantGroup);
$eligibleProductIds = $this->productRepository->getEligibleProductIdsForVariantGroup($variantGroup->getId());
$cursor = $this->getProductsCursor($configuration['filters']);
$paginator = $this->paginatorFactory->createPaginator($cursor);
list($productAttributeAxis, $acceptedIds) = $this->filterDuplicateAxisCombinations($paginator, $eligibleProductIds, $axisAttributeCodes);
$excludedIds = $this->addSkippedMessageForDuplicatedProducts($productAttributeAxis);
$acceptedIds = array_diff($acceptedIds, $excludedIds);
$configuration['filters'] = [['field' => 'id', 'operator' => 'IN', 'value' => $acceptedIds]];
if (0 === count($acceptedIds)) {
$configuration = null;
}
$this->setJobConfiguration(json_encode($configuration));
}