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


PHP GroupInterface::getCode方法代码示例

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


在下文中一共展示了GroupInterface::getCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 function it_provides_formatted_batch_config_for_the_job(GroupInterface $oroTshirt)
 {
     $oroTshirt->getCode()->willReturn('oro_tshirt');
     $this->setGroup($oroTshirt);
     $this->setFilters([['id', 'IN', ['22', '7']]]);
     $this->getBatchConfig()->shouldReturn('{\\"filters\\":[[\\"id\\",\\"IN\\",[\\"22\\",\\"7\\"]]],\\"actions\\":{\\"field\\":\\"variant_group\\",\\"value\\":\\"oro_tshirt\\"}}');
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:7,代码来源:AddToVariantGroupSpec.php

示例2:

 function it_provides_formatted_batch_config_for_the_job(GroupInterface $oroTshirt)
 {
     $oroTshirt->getCode()->willReturn('oro_tshirt');
     $this->setGroup($oroTshirt);
     $this->setFilters([['id', 'IN', ['22', '7']]]);
     $this->getBatchConfig()->shouldReturn(['filters' => [['id', 'IN', ['22', '7']]], 'actions' => ['field' => 'variant_group', 'value' => 'oro_tshirt']]);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:7,代码来源:AddToVariantGroupSpec.php

示例3: validateAttributeAxis

 /**
  * @param VariantGroupAxis $constraint
  * @param GroupInterface   $variantGroup
  */
 protected function validateAttributeAxis(VariantGroupAxis $constraint, GroupInterface $variantGroup)
 {
     $allowedTypes = [AttributeTypes::OPTION_SIMPLE_SELECT, AttributeTypes::REFERENCE_DATA_SIMPLE_SELECT];
     foreach ($variantGroup->getAxisAttributes() as $attribute) {
         if (!in_array($attribute->getAttributeType(), $allowedTypes)) {
             $this->addInvalidAxisViolation($constraint, $variantGroup->getCode(), $attribute->getCode());
         }
     }
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:13,代码来源:VariantGroupAxisValidator.php

示例4: FileNotFoundException

 function it_throws_an_exception_if_media_of_variant_group_is_not_found($normalizer, $denormalizer, ArrayCollection $productValuesCollection, ArrayCollection $mediaCollection, ProductMediaInterface $media, GroupInterface $variantGroup, ProductTemplateInterface $productTemplate, ProductValueInterface $productValue)
 {
     $variantGroup->getProductTemplate()->willReturn($productTemplate);
     $variantGroup->getCode()->willReturn('my_variant_group');
     $productTemplate->getValuesData()->willReturn([$productValue]);
     $denormalizer->denormalize([$productValue], 'ProductValue[]', 'json')->willReturn($productValuesCollection);
     $productValuesCollection->filter(Argument::cetera())->willReturn($mediaCollection);
     $mediaCollection->toArray()->willReturn([$media]);
     $normalizer->normalize([$media], 'csv', ['field_name' => 'media', 'prepare_copy' => true, 'identifier' => 'my_variant_group'])->willThrow(new FileNotFoundException('upload/path/img.jpg'));
     $this->shouldThrow(new InvalidItemException('The file "upload/path/img.jpg" does not exist', ['item' => 'my_variant_group', 'uploadDirectory' => 'upload/path/']))->duringProcess($variantGroup);
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:11,代码来源:VariantGroupProcessorSpec.php

示例5: fetchMedia

 /**
  * Fetch medias in local filesystem
  *
  * @param GroupInterface $variantGroup
  * @param string         $directory
  */
 protected function fetchMedia(GroupInterface $variantGroup, $directory)
 {
     if (null === ($productTemplate = $variantGroup->getProductTemplate())) {
         return;
     }
     $identifier = $variantGroup->getCode();
     $this->variantGroupUpdater->update($variantGroup, ['values' => $productTemplate->getValuesData()]);
     $this->mediaFetcher->fetchAll($productTemplate->getValues(), $directory, $identifier);
     foreach ($this->mediaFetcher->getErrors() as $error) {
         $this->stepExecution->addWarning($error['message'], [], new DataInvalidItem($error['media']));
     }
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:18,代码来源:VariantGroupProcessor.php

示例6:

 function it_provides_formatted_batch_config_for_the_job(GroupInterface $officeGroup, GroupInterface $bedroomGroup, ArrayCollection $groupCollection)
 {
     $officeGroup->getCode()->willReturn('office_room');
     $bedroomGroup->getCode()->willReturn('bedroom');
     $groupCollection->add($officeGroup);
     $groupCollection->add($bedroomGroup);
     $this->setGroups($groupCollection);
     $groupCollection->map(Argument::type('closure'))->willReturn($groupCollection);
     $groupCollection->toArray()->willReturn(['office_room', 'bedroom']);
     $this->setFilters([['id', 'IN', ['22', '7']]]);
     $this->getBatchConfig()->shouldReturn(['filters' => [['id', 'IN', ['22', '7']]], 'actions' => [['field' => 'groups', 'value' => ['office_room', 'bedroom']]]]);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:12,代码来源:AddToGroupsSpec.php

示例7:

 function it_provides_formatted_batch_config_for_the_job(GroupInterface $officeGroup, GroupInterface $bedroomGroup, ArrayCollection $groupCollection)
 {
     $officeGroup->getCode()->willReturn('office_room');
     $bedroomGroup->getCode()->willReturn('bedroom');
     $groupCollection->add($officeGroup);
     $groupCollection->add($bedroomGroup);
     $this->setGroups($groupCollection);
     $groupCollection->map(Argument::type('closure'))->willReturn($groupCollection);
     $groupCollection->toArray()->willReturn(['office_room', 'bedroom']);
     $this->setFilters([['id', 'IN', ['22', '7']]]);
     $this->getBatchConfig()->shouldReturn('{\\"filters\\":[[\\"id\\",\\"IN\\",[\\"22\\",\\"7\\"]]],\\"actions\\":[{\\"field\\":\\"groups\\",\\"value\\":[\\"office_room\\",\\"bedroom\\"]}]}');
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:12,代码来源:AddToGroupsSpec.php

示例8: validateProductTemplateValues

 /**
  * Validate variant group product template values
  *
  * @param GroupInterface $variantGroup
  * @param Constraint     $constraint
  */
 protected function validateProductTemplateValues(GroupInterface $variantGroup, Constraint $constraint)
 {
     $template = $variantGroup->getProductTemplate();
     $valuesData = $template->getValuesData();
     $forbiddenAttrCodes = $this->attributeRepository->findUniqueAttributeCodes();
     foreach ($variantGroup->getAxisAttributes() as $axisAttribute) {
         $forbiddenAttrCodes[] = $axisAttribute->getCode();
     }
     $invalidAttrCodes = array_intersect($forbiddenAttrCodes, array_keys($valuesData));
     if (count($invalidAttrCodes) > 0) {
         $this->context->buildViolation($constraint->message, ['%group%' => $variantGroup->getCode(), '%attributes%' => $this->formatValues($invalidAttrCodes)])->addViolation();
     }
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:19,代码来源:VariantGroupValuesValidator.php

示例9:

 function it_adds_a_violation_if_axis_attributes_are_invalid($context, GroupInterface $variantGroup, GroupType $type, VariantGroupAxis $constraint, ConstraintViolationBuilderInterface $violation, AttributeInterface $invalidAxis)
 {
     $variantGroup->getId()->willReturn(12);
     $variantGroup->getType()->willReturn($type);
     $variantGroup->getCode()->willReturn('tshirt');
     $type->isVariant()->willReturn(true);
     $variantGroup->getAxisAttributes()->willReturn([$invalidAxis]);
     $invalidAxis->getAttributeType()->willReturn(AttributeTypes::TEXT);
     $invalidAxis->getCode()->willReturn('name');
     $violationData = ['%group%' => 'tshirt', '%attribute%' => 'name'];
     $context->buildViolation($constraint->invalidAxisMessage, $violationData)->shouldBeCalled()->willReturn($violation);
     $this->validate($variantGroup, $constraint);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:13,代码来源:VariantGroupAxisValidatorSpec.php

示例10:

 function it_adds_a_violation_when_validates_a_product_with_missing_value_for_an_axe_of_its_variant_group($context, ProductInterface $product, GroupInterface $tShirtVariantGroup, AttributeInterface $sizeAttribute, AttributeInterface $colorAttribute, ProductValueInterface $sizeValue, ProductValueInterface $identifierValue, HasVariantAxes $constraint, ConstraintViolationBuilderInterface $violation)
 {
     $tShirtVariantGroup->getCode()->willReturn('tshirt');
     $tShirtVariantGroup->getAxisAttributes()->willReturn([$sizeAttribute, $colorAttribute]);
     $sizeAttribute->getCode()->willReturn('size');
     $colorAttribute->getCode()->willReturn('color');
     $product->getIdentifier()->willReturn($identifierValue);
     $product->getVariantGroup()->willReturn($tShirtVariantGroup);
     $product->getValue('size')->willReturn($sizeValue);
     $product->getValue('color')->willReturn(null);
     $sizeValue->getData()->willReturn('XL');
     $context->buildViolation('The product "%product%" is in the variant group "%variant%" but it misses the following axes: %axes%.', ['%product%' => $identifierValue, '%variant%' => 'tshirt', '%axes%' => 'color'])->shouldBeCalled()->willReturn($violation);
     $this->validate($product, $constraint);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:14,代码来源:HasVariantAxesValidatorSpec.php

示例11:

 function it_normalizes_a_product_associations_in_standard_format_only(ProductInterface $product, AssociationInterface $association1, AssociationInterface $association2, AssociationTypeInterface $associationType1, AssociationTypeInterface $associationType2, GroupInterface $group1, ProductInterface $productAssociated)
 {
     $group1->getCode()->willReturn('group_code');
     $associationType1->getCode()->willReturn('XSELL');
     $association1->getAssociationType()->willReturn($associationType1);
     $association1->getGroups()->willReturn([$group1]);
     $association1->getProducts()->willReturn([]);
     $productAssociated->getReference()->willReturn('product_code');
     $associationType2->getCode()->willReturn('PACK');
     $association2->getAssociationType()->willReturn($associationType2);
     $association2->getGroups()->willReturn([]);
     $association2->getProducts()->willReturn([$productAssociated]);
     $product->getAssociations()->willReturn([$association1, $association2]);
     $this->normalize($product, 'standard')->shouldReturn(['PACK' => ['groups' => [], 'products' => ['product_code']], 'XSELL' => ['groups' => ['group_code'], 'products' => []]]);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:15,代码来源:AssociationsNormalizerSpec.php

示例12: normalize

 /**
  * {@inheritdoc}
  *
  * @param GroupInterface $object
  */
 public function normalize($object, $format = null, array $context = [])
 {
     $results = ['code' => $object->getCode(), 'type' => $object->getType()->getCode()];
     $axisAttributes = $this->normalizeAxisAttributes($object);
     if (!empty($axisAttributes)) {
         $results += ['axis' => $axisAttributes];
     }
     $results += $this->transNormalizer->normalize($object, $format, $context);
     if (isset($context['versioning']) && true === $context['versioning']) {
         $context['with_variant_group_values'] = true;
     }
     if (isset($context['with_variant_group_values']) && true === $context['with_variant_group_values']) {
         $results['values'] = $this->normalizeVariantGroupValues($object, $format, $context);
     }
     return $results;
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:21,代码来源:GroupNormalizer.php

示例13:

 function it_saves_a_variant_group_and_copies_values_to_products($optionsResolver, $objectManager, $templateApplier, $eventDispatcher, GroupInterface $group, GroupType $type, ProductInterface $product, ProductTemplateInterface $template, ArrayCollection $products)
 {
     $optionsResolver->resolveSaveOptions(['copy_values_to_products' => true])->willReturn(['flush' => true, 'copy_values_to_products' => true, 'add_products' => [], 'remove_products' => []]);
     $group->getType()->willReturn($type);
     $group->getCode()->willReturn('my_code');
     $objectManager->persist($group)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $type->isVariant()->willReturn(true);
     $group->getProductTemplate()->willReturn($template);
     $group->getProducts()->willReturn($products);
     $products->toArray()->willReturn([$product]);
     $templateApplier->apply($template, [$product])->shouldBeCalled();
     $eventDispatcher->dispatch(StorageEvents::PRE_SAVE, Argument::cetera())->shouldBeCalled();
     $eventDispatcher->dispatch(StorageEvents::POST_SAVE, Argument::cetera())->shouldBeCalled();
     $this->save($group, ['copy_values_to_products' => true]);
 }
开发者ID:alexisfroger,项目名称:pim-community-dev,代码行数:16,代码来源:GroupSaverSpec.php

示例14:

 function it_adds_a_violation_if_variant_group_template_contains_a_unique_attribute(GroupInterface $variantGroup, GroupType $type, ProductTemplateInterface $template, VariantGroupValues $constraint, $attributeRepository, $context, ConstraintViolationBuilderInterface $violation)
 {
     $variantGroup->getType()->willReturn($type);
     $variantGroup->getCode()->willReturn('tshirt');
     $type->isVariant()->willReturn(true);
     $variantGroup->getProductTemplate()->willReturn($template);
     $variantGroup->getAxisAttributes()->willReturn([]);
     $attributeRepository->findUniqueAttributeCodes()->willReturn(['sku', 'barcode']);
     $template->getValuesData()->willReturn(['sku' => 'SKU-001']);
     $violationData = ['%group%' => 'tshirt', '%attributes%' => '"sku"'];
     $context->buildViolation($constraint->message, $violationData)->shouldBeCalled()->willReturn($violation);
     $this->validate($variantGroup, $constraint);
     $template->getValuesData()->willReturn(['sku' => 'SKU-001', 'barcode' => 01122334455]);
     $violationData = ['%group%' => 'tshirt', '%attributes%' => '"sku", "barcode"'];
     $context->buildViolation($constraint->message, $violationData)->shouldBeCalled()->willReturn($violation);
     $this->validate($variantGroup, $constraint);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:17,代码来源:VariantGroupValuesValidatorSpec.php

示例15:

 function it_normalizes_a_variant_group_with_its_values($transNormalizer, $valuesDenormalizer, $valuesNormalizer, GroupInterface $group, GroupTypeInterface $groupType, AttributeInterface $attr, ProductTemplateInterface $productTemplate)
 {
     $groupType->getCode()->willReturn('VARIANT');
     $groupType->isVariant()->willReturn(true);
     $group->getCode()->willReturn('laser_sabers');
     $valuesData = ['name' => 'Light saber model', 'size' => '120'];
     $context = ['with_variant_group_values' => true];
     $format = 'csv';
     $productTemplate->getValuesData()->willReturn($valuesData);
     $valuesDenormalizer->denormalize($valuesData, Argument::any(), Argument::any())->willReturn('denormalized_values');
     $valuesNormalizer->normalize('denormalized_values', Argument::any(), Argument::any())->willReturn('normalized_values');
     $group->getProductTemplate()->willReturn($productTemplate);
     $group->getType()->willReturn($groupType);
     $attr->getCode()->willReturn('light_color');
     $group->getAxisAttributes()->willReturn([$attr]);
     $transNormalizer->normalize($group, $format, $context)->willReturn([]);
     $this->normalize($group, $format, $context)->shouldReturn(['code' => 'laser_sabers', 'type' => 'VARIANT', 'axis' => ['light_color'], 'values' => 'normalized_values']);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:18,代码来源:GroupNormalizerSpec.php


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