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


PHP GroupInterface::setProductTemplate方法代码示例

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


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

示例1: ProductValue

 function it_updates_a_variant_group($attributeRepository, $groupTypeRepository, $productBuilder, GroupInterface $variantGroup, AttributeInterface $attribute, GroupTypeInterface $type, GroupTranslation $translatable, ProductInterface $product, ProductTemplateInterface $productTemplate)
 {
     $groupTypeRepository->findOneByIdentifier('VARIANT')->willReturn($type);
     $attributeRepository->findOneByIdentifier('main_color')->willReturn($attribute);
     $attributeRepository->findOneByIdentifier('secondary_color')->willReturn($attribute);
     $variantGroup->getTranslation()->willReturn($translatable);
     $translatable->setLabel('T-shirt super beau')->shouldBeCalled();
     $variantGroup->setCode('mycode')->shouldBeCalled();
     $variantGroup->setLocale('fr_FR')->shouldBeCalled();
     $variantGroup->setType($type)->shouldBeCalled();
     $variantGroup->getId()->willReturn(null);
     $variantGroup->addAxisAttribute(Argument::any())->shouldBeCalled();
     $productTemplate->getValuesData()->willReturn([]);
     $productTemplate->setValues(Argument::any())->shouldBeCalled();
     $productTemplate->setValuesData(['main_color' => [['locale' => null, 'scope' => null, 'data' => 'white']]])->shouldBeCalled();
     $variantGroup->getProductTemplate()->willReturn($productTemplate);
     $variantGroup->setProductTemplate($productTemplate)->shouldBeCalled();
     $productValue = new ProductValue();
     $identifierValue = new ProductValue();
     $productBuilder->createProduct()->willReturn($product);
     $product->getValues()->willReturn(new ArrayCollection([$productValue, $identifierValue]));
     $product->getIdentifier()->willReturn($identifierValue);
     $values = ['code' => 'mycode', 'axis' => ['main_color', 'secondary_color'], 'type' => 'VARIANT', 'labels' => ['fr_FR' => 'T-shirt super beau'], 'values' => ['main_color' => [['locale' => null, 'scope' => null, 'data' => 'white']]]];
     $this->update($variantGroup, $values, []);
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:25,代码来源:VariantGroupUpdaterSpec.php

示例2: getProductTemplate

 /**
  * @param GroupInterface $variantGroup
  *
  * @return \Pim\Component\Catalog\Model\ProductTemplateInterface
  */
 protected function getProductTemplate(GroupInterface $variantGroup)
 {
     if ($variantGroup->getProductTemplate()) {
         $template = $variantGroup->getProductTemplate();
     } else {
         $template = new $this->templateClass();
         $variantGroup->setProductTemplate($template);
     }
     return $template;
 }
开发者ID:abdeldayem,项目名称:pim-community-dev,代码行数:15,代码来源:VariantGroupProcessor.php

示例3:

 function it_merges_original_and_new_values(GroupInterface $variantGroup, ProductTemplateInterface $template, ProductBuilderInterface $productBuilder, ProductInterface $product, ProductValueInterface $identifier, ArrayCollection $values, \Iterator $valuesIterator)
 {
     $originalValues = ['description' => [['locale' => 'en_US', 'scope' => 'ecommerce', 'data' => 'original description en_US'], ['locale' => 'de_DE', 'scope' => 'ecommerce', 'data' => 'original description de_DE']]];
     $newValues = ['description' => [['locale' => 'en_US', 'scope' => 'ecommerce', 'data' => 'new description en_US'], ['locale' => 'fr_FR', 'scope' => 'ecommerce', 'data' => 'new description fr_FR']]];
     $expectedValues = ['description' => [['locale' => 'en_US', 'scope' => 'ecommerce', 'data' => 'new description en_US'], ['locale' => 'de_DE', 'scope' => 'ecommerce', 'data' => 'original description de_DE'], ['locale' => 'fr_FR', 'scope' => 'ecommerce', 'data' => 'new description fr_FR']]];
     $variantGroup->getProductTemplate()->willReturn($template);
     $template->getValuesData()->willReturn($originalValues);
     $productBuilder->createProduct()->willReturn($product);
     $product->getValues()->willReturn($values);
     $product->getIdentifier()->willReturn($identifier);
     $values->removeElement($identifier)->shouldBeCalled();
     $values->getIterator()->willReturn($valuesIterator);
     $template->setValues($values)->shouldBeCalled();
     $template->setValuesData($expectedValues)->shouldBeCalled();
     $variantGroup->setProductTemplate($template)->shouldBeCalled();
     $this->setValues($variantGroup, $newValues);
 }
开发者ID:a2xchip,项目名称:pim-community-dev,代码行数:17,代码来源:VariantGroupUpdaterSpec.php


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