當前位置: 首頁>>代碼示例>>PHP>>正文


PHP GroupInterface::getTranslation方法代碼示例

本文整理匯總了PHP中Pim\Bundle\CatalogBundle\Model\GroupInterface::getTranslation方法的典型用法代碼示例。如果您正苦於以下問題:PHP GroupInterface::getTranslation方法的具體用法?PHP GroupInterface::getTranslation怎麽用?PHP GroupInterface::getTranslation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pim\Bundle\CatalogBundle\Model\GroupInterface的用法示例。


在下文中一共展示了GroupInterface::getTranslation方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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:noglitchyo,項目名稱:pim-community-dev,代碼行數:25,代碼來源:VariantGroupUpdaterSpec.php

示例2:

 function it_updates_a_group($groupTypeRepository, GroupInterface $group, GroupTypeInterface $type, GroupTranslation $translatable)
 {
     $groupTypeRepository->findOneByIdentifier('RELATED')->willReturn($type);
     $group->getTranslation()->willReturn($translatable);
     $translatable->setLabel('T-shirt super beau')->shouldBeCalled();
     $group->setCode('mycode')->shouldBeCalled();
     $group->setLocale('fr_FR')->shouldBeCalled();
     $group->setType($type)->shouldBeCalled();
     $group->getId()->willReturn(null);
     $values = ['code' => 'mycode', 'type' => 'RELATED', 'labels' => ['fr_FR' => 'T-shirt super beau']];
     $this->update($group, $values, []);
 }
開發者ID:noglitchyo,項目名稱:pim-community-dev,代碼行數:12,代碼來源:GroupUpdaterSpec.php

示例3: setLabels

 /**
  * @param GroupInterface $variantGroup
  * @param array          $labels
  *
  * @throws \InvalidArgumentException
  */
 protected function setLabels(GroupInterface $variantGroup, array $labels)
 {
     foreach ($labels as $localeCode => $label) {
         $variantGroup->setLocale($localeCode);
         $translation = $variantGroup->getTranslation();
         $translation->setLabel($label);
     }
 }
開發者ID:jacko972,項目名稱:pim-community-dev,代碼行數:14,代碼來源:VariantGroupUpdater.php

示例4: setLabels

 /**
  * @param GroupInterface $group
  * @param array          $data
  */
 protected function setLabels(GroupInterface $group, $data)
 {
     foreach ($data as $field => $value) {
         $isLabel = false !== strpos($field, 'label-', 0);
         if ($isLabel) {
             $labelTokens = explode('-', $field);
             $localeCode = $labelTokens[1];
             $translation = $group->getTranslation($localeCode);
             $translation->setLabel($value);
             $group->addTranslation($translation);
         }
     }
 }
開發者ID:noglitchyo,項目名稱:pim-community-dev,代碼行數:17,代碼來源:GroupDenormalizer.php


注:本文中的Pim\Bundle\CatalogBundle\Model\GroupInterface::getTranslation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。