当前位置: 首页>>代码示例>>PHP>>正文


PHP GroupInterface::getLabel方法代码示例

本文整理汇总了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);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:22,代码来源:UniqueVariantAxisValidatorSpec.php

示例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;
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:29,代码来源:UniqueVariantAxisValidator.php


注:本文中的Pim\Component\Catalog\Model\GroupInterface::getLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。