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


PHP GroupInterface::getLabel方法代码示例

本文整理汇总了PHP中Pim\Bundle\CatalogBundle\Model\GroupInterface::getLabel方法的典型用法代码示例。如果您正苦于以下问题:PHP GroupInterface::getLabel方法的具体用法?PHP GroupInterface::getLabel怎么用?PHP GroupInterface::getLabel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pim\Bundle\CatalogBundle\Model\GroupInterface的用法示例。


在下文中一共展示了GroupInterface::getLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:noglitchyo,项目名称: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 = array();
     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()) {
             $criteria[] = ['attribute' => $attribute, 'option' => $value->getOption()];
         } else {
             $this->addEmptyAxisViolation($constraint, $variantGroup->getLabel(), $product->getIdentifier()->getVarchar(), $attribute->getCode());
         }
     }
     return $criteria;
 }
开发者ID:umpirsky,项目名称:pim-community-dev,代码行数:23,代码来源:UniqueVariantAxisValidator.php

示例3: 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:noglitchyo,项目名称:pim-community-dev,代码行数:29,代码来源:UniqueVariantAxisValidator.php

示例4:

 function it_adds_a_violation_when_validating_product_in_groups_with_non_unique_combination_of_axis_attributes($context, $productRepository, GroupInterface $tShirtVariantGroup, GroupTypeInterface $tShirtGroupType, GroupInterface $clothesVariantGroup, GroupTypeInterface $clothesGroupType, ProductInterface $redTShirtProduct, AttributeInterface $sizeAttribute, AttributeInterface $colorAttribute, ProductValueInterface $sizeProductValue, ProductValueInterface $colorProductValue, ProductInterface $redTShirtProduct2, UniqueVariantAxis $uniqueVariantAxisConstraint)
 {
     $redTShirtProduct->getGroups()->willReturn([$tShirtVariantGroup, $clothesVariantGroup]);
     $tShirtVariantGroup->getId()->willReturn(1);
     $tShirtVariantGroup->getLabel()->willReturn('TShirts');
     $tShirtVariantGroup->getType()->willReturn($tShirtGroupType);
     $tShirtGroupType->isVariant()->willReturn(true);
     $tShirtVariantGroup->getAxisAttributes()->willReturn([$sizeAttribute, $colorAttribute]);
     $clothesVariantGroup->getId()->willReturn(2);
     $clothesVariantGroup->getLabel()->willReturn('Clothes');
     $clothesVariantGroup->getType()->willReturn($clothesGroupType);
     $clothesGroupType->isVariant()->willReturn(true);
     $clothesVariantGroup->getAxisAttributes()->willReturn([$sizeAttribute, $colorAttribute]);
     $sizeAttribute->getCode()->willReturn('size');
     $colorAttribute->getCode()->willReturn('color');
     $redTShirtProduct->getValue('size')->willReturn($sizeProductValue);
     $redTShirtProduct->getValue('color')->willReturn($colorProductValue);
     $redTShirtProduct->getId()->willReturn(1);
     $sizeProductValue->getOption()->willReturn('XL');
     $colorProductValue->getOption()->willReturn('Red');
     $redTShirtProduct2->getGroups()->willReturn([$clothesVariantGroup]);
     $redTShirtProduct2->getValue('size')->willReturn($sizeProductValue);
     $redTShirtProduct2->getValue('color')->willReturn($colorProductValue);
     $redTShirtProduct2->getId()->willReturn(2);
     $criteria = [['attribute' => $sizeAttribute, 'option' => 'XL'], ['attribute' => $colorAttribute, 'option' => 'Red']];
     $productRepository->findAllForVariantGroup($tShirtVariantGroup, $criteria)->willReturn([]);
     $productRepository->findAllForVariantGroup($clothesVariantGroup, $criteria)->willReturn([$redTShirtProduct2]);
     $context->addViolation('Group "%variant group%" already contains another product with values "%values%"', ['%variant group%' => 'Clothes', '%values%' => 'size: XL, color: Red'])->shouldBeCalled();
     $this->validate($redTShirtProduct, $uniqueVariantAxisConstraint);
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:30,代码来源:UniqueVariantAxisValidatorSpec.php


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