本文整理汇总了PHP中Pim\Component\Catalog\Model\GroupInterface::getLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupInterface::getLabel方法的具体用法?PHP GroupInterface::getLabel怎么用?PHP GroupInterface::getLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pim\Component\Catalog\Model\GroupInterface
的用法示例。
在下文中一共展示了GroupInterface::getLabel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_does_not_add_violation_when_validating_product_in_groups_with_unique_combination_of_axis_attributes($context, $productRepository, GroupInterface $tShirtVariantGroup, GroupTypeInterface $tShirtGroupType, ProductInterface $redTShirtProduct, AttributeInterface $sizeAttribute, AttributeInterface $colorAttribute, ProductValueInterface $sizeProductValue, ProductValueInterface $redColorProductValue, UniqueVariantAxis $uniqueVariantAxisConstraint)
{
$tShirtVariantGroup->getId()->willReturn(1);
$tShirtVariantGroup->getLabel()->willReturn('TShirts');
$tShirtVariantGroup->getType()->willReturn($tShirtGroupType);
$tShirtGroupType->isVariant()->willReturn(true);
$tShirtVariantGroup->getAxisAttributes()->willReturn([$sizeAttribute, $colorAttribute]);
$sizeAttribute->getCode()->willReturn('size');
$sizeAttribute->isBackendTypeReferenceData()->willReturn(false);
$colorAttribute->getCode()->willReturn('color');
$colorAttribute->isBackendTypeReferenceData()->willReturn(false);
$redTShirtProduct->getVariantGroup()->willReturn($tShirtVariantGroup);
$redTShirtProduct->getId()->willReturn(1);
$redTShirtProduct->getValue('size')->willReturn($sizeProductValue);
$redTShirtProduct->getValue('color')->willReturn($redColorProductValue);
$sizeProductValue->getOption()->willReturn('XL');
$redColorProductValue->getOption()->willReturn('Red');
$criteria = [['attribute' => $sizeAttribute, 'option' => 'XL'], ['attribute' => $colorAttribute, 'option' => 'Red']];
$productRepository->findAllForVariantGroup($tShirtVariantGroup, $criteria)->willReturn([]);
$context->buildViolation()->shouldNotBeCalled(Argument::cetera());
$this->validate($redTShirtProduct, $uniqueVariantAxisConstraint);
}
示例2: prepareQueryCriterias
/**
* Prepare query criteria for variant group
*
* @param GroupInterface $variantGroup
* @param ProductInterface $product
* @param Constraint $constraint
*
* @return array
*/
protected function prepareQueryCriterias(GroupInterface $variantGroup, ProductInterface $product, Constraint $constraint)
{
$criteria = [];
foreach ($variantGroup->getAxisAttributes() as $attribute) {
$value = $product->getValue($attribute->getCode());
// we don't add criteria when option is null, as this check is performed by HasVariantAxesValidator
if (null === $value || null === $value->getOption() && !$attribute->isBackendTypeReferenceData()) {
$this->addEmptyAxisViolation($constraint, $variantGroup->getLabel(), $product->getIdentifier()->getVarchar(), $attribute->getCode());
continue;
}
$current = ['attribute' => $attribute];
if (null !== $value->getOption()) {
$current['option'] = $value->getOption();
} elseif ($attribute->isBackendTypeReferenceData()) {
$current['referenceData'] = ['name' => $attribute->getReferenceDataName(), 'data' => $value->getData()];
}
$criteria[] = $current;
}
return $criteria;
}