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


PHP ProductInterface::getAttributes方法代码示例

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


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

示例1:

 function it_adds_missing_product_values_from_family_on_new_product($valuesResolver, FamilyInterface $family, ProductInterface $product, AttributeInterface $sku, AttributeInterface $name, AttributeInterface $desc, ProductValueInterface $skuValue)
 {
     $sku->getCode()->willReturn('sku');
     $sku->getAttributeType()->willReturn('pim_catalog_identifier');
     $sku->isLocalizable()->willReturn(false);
     $sku->isScopable()->willReturn(false);
     $name->getCode()->willReturn('name');
     $name->getAttributeType()->willReturn('pim_catalog_text');
     $name->isLocalizable()->willReturn(true);
     $name->isScopable()->willReturn(false);
     $desc->getCode()->willReturn('description');
     $desc->getAttributeType()->willReturn('pim_catalog_text');
     $desc->isLocalizable()->willReturn(true);
     $desc->isScopable()->willReturn(true);
     // get expected attributes
     $product->getAttributes()->willReturn([$sku]);
     $family->getAttributes()->willReturn([$sku, $name, $desc]);
     $product->getFamily()->willReturn($family);
     // get eligible values
     $valuesResolver->resolveEligibleValues(['sku' => $sku, 'name' => $name, 'description' => $desc])->willReturn([['attribute' => 'sku', 'type' => 'pim_catalog_identifier', 'locale' => null, 'scope' => null], ['attribute' => 'name', 'type' => 'pim_catalog_text', 'locale' => 'fr_FR', 'scope' => null], ['attribute' => 'name', 'type' => 'pim_catalog_text', 'locale' => 'en_US', 'scope' => null], ['attribute' => 'description', 'type' => 'pim_catalog_text', 'locale' => 'en_US', 'scope' => 'ecommerce'], ['attribute' => 'description', 'type' => 'pim_catalog_text', 'locale' => 'fr_FR', 'scope' => 'ecommerce'], ['attribute' => 'description', 'type' => 'pim_catalog_text', 'locale' => 'en_US', 'scope' => 'print'], ['attribute' => 'description', 'type' => 'pim_catalog_text', 'locale' => 'fr_FR', 'scope' => 'print']]);
     // get existing values
     $skuValue->getAttribute()->willReturn($sku);
     $skuValue->getLocale()->willReturn(null);
     $skuValue->getScope()->willReturn(null);
     $product->getValues()->willReturn([$skuValue]);
     // add 6 new values : 4 desc (locales x scopes) + 2 name (locales
     $product->addValue(Argument::any())->shouldBeCalledTimes(6);
     $this->addMissingProductValues($product);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:29,代码来源:ProductBuilderSpec.php

示例2: realpath

 function it_renders_a_product_with_an_image($templating, ProductInterface $blender, AttributeGroupInterface $media, AttributeInterface $mainImage)
 {
     $path = realpath(__DIR__ . '/../../../../../features/Context/fixtures/');
     $blender->getAttributes()->willReturn([$mainImage]);
     $mainImage->getGroup()->willReturn($media);
     $media->getLabel()->willReturn('Media');
     $mainImage->getCode()->willReturn('main_image');
     $mainImage->getAttributeType()->willReturn('pim_catalog_image');
     $templating->render(self::TEMPLATE_NAME, ['product' => $blender, 'locale' => 'en_US', 'scope' => 'ecommerce', 'groupedAttributes' => ['Media' => ['main_image' => $mainImage]], 'imageAttributes' => ['main_image' => $mainImage], 'uploadDir' => $path . DIRECTORY_SEPARATOR, 'customFont' => null])->shouldBeCalled();
     $this->render($blender, 'pdf', ['locale' => 'en_US', 'scope' => 'ecommerce']);
 }
开发者ID:umpirsky,项目名称:pim-community-dev,代码行数:11,代码来源:ProductPdfRendererSpec.php

示例3: realpath

 function it_renders_a_product_with_an_image($templating, ProductInterface $blender, AttributeGroupInterface $media, AttributeInterface $mainImage, ProductValueInterface $productValue, FileInfoInterface $fileInfo, CacheManager $cacheManager)
 {
     $path = realpath(__DIR__ . '/../../../../../features/Context/fixtures/');
     $blender->getAttributes()->willReturn([$mainImage]);
     $blender->getValue("main_image", "en_US", "ecommerce")->willReturn($productValue);
     $productValue->getMedia()->willReturn($fileInfo);
     $fileInfo->getKey()->willReturn('fookey');
     $cacheManager->isStored('fookey', 'thumbnail')->willReturn(true);
     $mainImage->getGroup()->willReturn($media);
     $media->getLabel()->willReturn('Media');
     $mainImage->getCode()->willReturn('main_image');
     $mainImage->getAttributeType()->willReturn('pim_catalog_image');
     $templating->render(self::TEMPLATE_NAME, ['product' => $blender, 'locale' => 'en_US', 'scope' => 'ecommerce', 'groupedAttributes' => ['Media' => ['main_image' => $mainImage]], 'imageAttributes' => ['main_image' => $mainImage], 'uploadDir' => $path . DIRECTORY_SEPARATOR, 'customFont' => null])->shouldBeCalled();
     $this->render($blender, 'pdf', ['locale' => 'en_US', 'scope' => 'ecommerce']);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:15,代码来源:ProductPdfRendererSpec.php

示例4:

 function it_adds_missing_product_values_from_family_on_new_product(FamilyInterface $family, ProductInterface $product, AttributeInterface $sku, AttributeInterface $name, AttributeInterface $desc, $localeRepository, LocaleInterface $fr, LocaleInterface $en, $channelRepository, ChannelInterface $ecom, ChannelInterface $print, ProductValueInterface $skuValue)
 {
     // get expected attributes
     $product->getAttributes()->willReturn([$sku]);
     $product->getFamily()->willReturn($family);
     $family->getAttributes()->willReturn([$sku, $name, $desc]);
     // get expected values
     $sku->getCode()->willReturn('sku');
     $sku->getAttributeType()->willReturn('pim_catalog_identifier');
     $sku->isLocalizable()->willReturn(false);
     $sku->isScopable()->willReturn(false);
     $sku->isLocaleSpecific()->willReturn(false);
     $name->getCode()->willReturn('name');
     $name->getAttributeType()->willReturn('pim_catalog_text');
     $name->isLocalizable()->willReturn(true);
     $name->isScopable()->willReturn(false);
     $name->isLocaleSpecific()->willReturn(false);
     $desc->getCode()->willReturn('desc');
     $desc->getAttributeType()->willReturn('pim_catalog_text');
     $desc->isLocalizable()->willReturn(true);
     $desc->isScopable()->willReturn(true);
     $desc->isLocaleSpecific()->willReturn(false);
     $fr->getCode()->willReturn('fr_FR');
     $en->getCode()->willReturn('fr_FR');
     $localeRepository->getActivatedLocales()->willReturn([$fr, $en]);
     $ecom->getCode()->willReturn('ecom');
     $ecom->getLocales()->willReturn([$en, $fr]);
     $print->getCode()->willReturn('print');
     $print->getLocales()->willReturn([$en, $fr]);
     $channelRepository->findAll()->willReturn([$ecom, $print]);
     // get existing values
     $skuValue->getAttribute()->willReturn($sku);
     $skuValue->getLocale()->willReturn(null);
     $skuValue->getScope()->willReturn(null);
     $product->getValues()->willReturn([$skuValue]);
     // add 6 new values : 4 desc (locales x scopes) + 2 name (locales
     $product->addValue(Argument::any())->shouldBeCalledTimes(6);
     $this->addMissingProductValues($product);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:39,代码来源:ProductBuilderSpec.php

示例5: getAttributes

 /**
  * Get attributes to display
  *
  * @param ProductInterface $product
  * @param string           $locale
  *
  * @return AttributeInterface[]
  */
 protected function getAttributes(ProductInterface $product, $locale)
 {
     return $product->getAttributes();
 }
开发者ID:jacko972,项目名称:pim-community-dev,代码行数:12,代码来源:ProductPdfRenderer.php

示例6: getExpectedAttributes

 /**
  * Get expected attributes for the product
  *
  * @param ProductInterface $product
  *
  * @return AttributeInterface[]
  */
 protected function getExpectedAttributes(ProductInterface $product)
 {
     $attributes = [];
     $productAttributes = $product->getAttributes();
     foreach ($productAttributes as $attribute) {
         $attributes[$attribute->getCode()] = $attribute;
     }
     if ($family = $product->getFamily()) {
         foreach ($family->getAttributes() as $attribute) {
             $attributes[$attribute->getCode()] = $attribute;
         }
     }
     return $attributes;
 }
开发者ID:qrz-io,项目名称:pim-community-dev,代码行数:21,代码来源:ProductBuilder.php

示例7: getProductEditTemplateParams

 /**
  * Get the product edit template parameters
  *
  * @param FormInterface    $form
  * @param ProductInterface $product
  * @param array            $channels
  * @param array            $trees
  *
  * @return array
  */
 protected function getProductEditTemplateParams(FormInterface $form, ProductInterface $product, array $channels, array $trees)
 {
     $defaultParameters = array('form' => $form->createView(), 'dataLocale' => $this->getDataLocaleCode(), 'comparisonLocale' => $this->getComparisonLocale(), 'channels' => $channels, 'attributesForm' => $this->getAvailableAttributesForm($product->getAttributes())->createView(), 'product' => $product, 'trees' => $trees, 'created' => $this->versionManager->getOldestLogEntry($product), 'updated' => $this->versionManager->getNewestLogEntry($product), 'locales' => $this->getUserLocales(), 'createPopin' => $this->getRequest()->get('create_popin'));
     $event = new GenericEvent($this, ['parameters' => $defaultParameters]);
     $this->dispatch(ProductEvents::PRE_RENDER_EDIT, $event);
     return $event->getArgument('parameters');
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:17,代码来源:ProductController.php


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