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


PHP ProductInterface::getCompletenesses方法代码示例

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


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

示例1: ArrayCollection

 function it_provide_product_completeness_if_a_family_is_defined($familyRepository, $productValueCompleteChecker, QueryBuilder $qb, AbstractQuery $query, AttributeRequirementInterface $requirement, ProductInterface $product, ChannelInterface $mobile, LocaleInterface $en, FamilyInterface $shirt, CompletenessInterface $completeness, ProductValueInterface $nameValue, AttributeInterface $name)
 {
     $product->getFamily()->willReturn($shirt);
     $product->getCompletenesses()->willReturn([$completeness]);
     $en->getCode()->willReturn('en_US');
     $mobile->getCode()->willReturn('mobile');
     $completeness->getLocale()->willReturn($en);
     $completeness->getChannel()->willReturn($mobile);
     $completeness->getMissingCount()->willReturn(1);
     $familyRepository->getFullRequirementsQB($shirt, 'en_US')->willReturn($qb);
     $qb->getQuery()->willReturn($query);
     $query->getResult()->willReturn([$requirement]);
     $requirement->getChannel()->willReturn($mobile);
     $requirement->getAttribute()->willReturn($name);
     $requirement->isRequired()->willReturn(true);
     $name->getCode()->willReturn('name');
     $name->isLocalizable()->willreturn(true);
     $name->isScopable()->willReturn(false);
     $name->isLocaleSpecific()->willReturn(true);
     $name->hasLocaleSpecific($en)->willReturn(false);
     $product->getValues()->willReturn(new ArrayCollection());
     $productValueCompleteChecker->supportsValue($nameValue);
     $productValueCompleteChecker->isComplete($nameValue, $mobile, $en);
     $this->getProductCompleteness($product, [$mobile], [$en], 'en_US')->shouldReturn(['en_US' => ['channels' => ['mobile' => ['completeness' => $completeness, 'missing' => []]], 'stats' => ['total' => 1, 'complete' => 0]]]);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:25,代码来源:CompletenessManagerSpec.php

示例2: isProductComplete

 /**
  * Is the given product complete for the given channel?
  *
  * @param ProductInterface $product
  * @param Channel          $channel
  *
  * @return bool
  */
 protected function isProductComplete(ProductInterface $product, Channel $channel)
 {
     $completenesses = $product->getCompletenesses()->toArray();
     foreach ($completenesses as $completeness) {
         if ($completeness->getChannel()->getId() === $channel->getId() && $completeness->getRatio() === 100) {
             return true;
         }
     }
     return false;
 }
开发者ID:rskonieczka,项目名称:MagentoConnectorBundle,代码行数:18,代码来源:ExportableProductFilter.php

示例3: apply

 /**
  * @param ProductInterface $product
  * @param Channel          $locales
  *
  * @return Locale[]
  */
 public function apply(ProductInterface $product, Channel $channel)
 {
     $exportableLocales = [];
     foreach ($product->getCompletenesses() as $completeness) {
         if ($this->isComplete($completeness) && $this->isInChannel($completeness, $channel)) {
             $exportableLocales[] = $completeness->getLocale();
         }
     }
     return $exportableLocales;
 }
开发者ID:mejdoubimeriem,项目名称:prestashopconnector,代码行数:16,代码来源:ExportableLocaleFilter.php

示例4:

 function it_does_not_send_locales_which_are_not_complete(ProductInterface $product, Channel $channel, AbstractCompleteness $completeness1, AbstractCompleteness $completeness2, Locale $localeFr, Locale $localeEn)
 {
     $product->getCompletenesses()->willReturn([$completeness1, $completeness2]);
     $completeness1->getRatio()->willReturn(100);
     $completeness2->getRatio()->willReturn(90);
     $completeness1->getChannel()->willReturn($channel);
     $completeness1->getLocale()->willReturn($localeEn);
     $completeness2->getChannel()->willReturn($channel);
     $completeness2->getLocale()->willReturn($localeFr);
     $channel->getId()->willReturn(2);
     $this->apply($product, $channel)->shouldReturn([$localeEn]);
 }
开发者ID:rskonieczka,项目名称:MagentoConnectorBundle,代码行数:12,代码来源:ExportableLocaleFilterSpec.php

示例5:

 function it_does_not_generate_association_calls_for_given_products_if_associated_product_is_not_complete_nor_enable($webservice, ProductInterface $product, ProductInterface $associatedProduct, Association $association, AssociationType $associationType, Completeness $completeness)
 {
     $webservice->getAssociationsStatus($product)->willReturn(['up_sell' => [], 'cross_sell' => [['sku' => 'sku-011']], 'related' => []]);
     $product->getIdentifier()->willReturn('sku-012');
     $product->getAssociations()->willReturn([$association]);
     $association->getAssociationType()->willReturn($associationType);
     $association->getProducts()->willReturn([$associatedProduct]);
     $associatedProduct->getIdentifier()->willReturn('sku-011');
     $associatedProduct->isEnabled()->willReturn(false);
     $associatedProduct->getCompletenesses()->willReturn([$completeness]);
     $completeness->getRatio()->willReturn(50);
     $associationType->getCode()->willReturn('UPSELL');
     $this->process([$product])->shouldReturn(['remove' => [['type' => 'cross_sell', 'product' => 'sku-012', 'linkedProduct' => 'sku-011', 'identifierType' => 'sku']], 'create' => []]);
 }
开发者ID:rskonieczka,项目名称:MagentoConnectorBundle,代码行数:14,代码来源:ProductAssociationProcessorSpec.php

示例6: array

 function it_normalizes_product(SerializerInterface $serializer, ProductInterface $product, FamilyInterface $family, Completeness $completeness)
 {
     $serializer->implement('Symfony\\Component\\Serializer\\Normalizer\\NormalizerInterface');
     $this->setSerializer($serializer);
     $product->getFamily()->willReturn($family);
     $product->getGroups()->willReturn([]);
     $product->getValues()->willReturn([]);
     $product->getCompletenesses()->willReturn([$completeness]);
     $product->getCreated()->willReturn(null);
     $product->getUpdated()->willReturn(null);
     $product->isEnabled()->willReturn(true);
     $serializer->normalize($family, 'mongodb_json', [])->willReturn('family normalization');
     $serializer->normalize($completeness, 'mongodb_json', [])->willReturn(['completenessCode' => 'completeness normalization']);
     $this->normalize($product, 'mongodb_json', [])->shouldReturn([ProductNormalizer::FAMILY_FIELD => 'family normalization', ProductNormalizer::COMPLETENESSES_FIELD => array('completenessCode' => 'completeness normalization'), ProductNormalizer::ENABLED_FIELD => true]);
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:15,代码来源:ProductNormalizerSpec.php

示例7:

 function it_returns_only_products_in_the_given_channel(ProductInterface $product1, ProductInterface $product2, Channel $channel, ArrayCollection $productCategories1, ArrayCollection $productCategories2, ArrayCollection $completenesses, Category $rootCategory, Category $category1, Category $category2, AbstractCompleteness $completeness1, AbstractCompleteness $completeness2)
 {
     $channel->getCategory()->willReturn($rootCategory);
     $channel->getId()->willReturn(2);
     $rootCategory->getId()->willReturn(1);
     $product1->getCategories()->willReturn($productCategories1);
     $product2->getCategories()->willReturn($productCategories2);
     $product1->getCompletenesses()->willReturn($completenesses);
     $product2->getCompletenesses()->willReturn($completenesses);
     $completenesses->toArray()->willReturn([$completeness1, $completeness2]);
     $completeness1->getChannel()->willReturn($channel);
     $completeness2->getChannel()->willReturn($channel);
     $completeness1->getRatio()->willReturn(100);
     $completeness2->getRatio()->willReturn(100);
     $productCategories1->toArray()->willReturn([$category1]);
     $productCategories2->toArray()->willReturn([$category2]);
     $category1->getRoot()->willReturn(1);
     $category2->getRoot()->willReturn(5);
     $this->apply($channel, [$product1, $product2])->shouldReturn([$product1]);
 }
开发者ID:rskonieczka,项目名称:MagentoConnectorBundle,代码行数:20,代码来源:ExportableProductFilterSpec.php

示例8: getProductCompleteness

 /**
  * Returns an array containing all completeness info and missing attributes for a product
  *
  * @param ProductInterface                                    $product
  * @param \Pim\Bundle\CatalogBundle\Entity\ChannelInterface[] $channels
  * @param \Pim\Bundle\CatalogBundle\Entity\LocaleInterface[]  $locales
  * @param string                                              $localeCode
  *
  * @return array
  */
 public function getProductCompleteness(ProductInterface $product, array $channels, array $locales, $localeCode)
 {
     $family = $product->getFamily();
     $getCodes = function ($entities) {
         return array_map(function ($entity) {
             return $entity->getCode();
         }, $entities);
     };
     $channelCodes = $getCodes($channels);
     $localeCodes = $getCodes($locales);
     $channelTemplate = ['channels' => array_fill_keys($channelCodes, ['completeness' => null, 'missing' => []]), 'stats' => ['total' => 0, 'complete' => 0]];
     $completenesses = array_fill_keys($localeCodes, $channelTemplate);
     if (!$family) {
         return $completenesses;
     }
     $allCompletenesses = $product->getCompletenesses();
     foreach ($allCompletenesses as $completeness) {
         $locale = $completeness->getLocale();
         $channel = $completeness->getChannel();
         $compLocaleCode = $locale->getCode();
         if (isset($completenesses[$compLocaleCode])) {
             $completenesses[$compLocaleCode]['channels'][$channel->getCode()]['completeness'] = $completeness;
             $completenesses[$compLocaleCode]['stats']['total']++;
             if (0 === $completeness->getMissingCount()) {
                 $completenesses[$compLocaleCode]['stats']['complete']++;
             }
         }
     }
     $requirements = $this->familyRepository->getFullRequirementsQB($family, $localeCode)->getQuery()->getResult();
     $productValues = $product->getValues();
     foreach ($requirements as $requirement) {
         if ($requirement->isRequired()) {
             $this->addRequirementToCompleteness($completenesses, $requirement, $productValues, $locales);
         }
     }
     return $completenesses;
 }
开发者ID:bertterheide,项目名称:pim-community-dev,代码行数:47,代码来源:CompletenessManager.php

示例9: schedule

 /**
  * {@inheritdoc}
  */
 public function schedule(ProductInterface $product)
 {
     foreach ($product->getCompletenesses() as $completeness) {
         $this->manager->remove($completeness);
     }
     $product->getCompletenesses()->clear();
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:10,代码来源:CompletenessGenerator.php

示例10: schedule

 /**
  * {@inheritdoc}
  */
 public function schedule(ProductInterface $product)
 {
     $product->getCompletenesses()->clear();
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:7,代码来源:CompletenessGenerator.php

示例11: isComplete

 /**
  * @param ProductInterface $product
  *
  * @return bool
  */
 protected function isComplete(ProductInterface $product)
 {
     $isComplete = false;
     $completenesses = $product->getCompletenesses();
     foreach ($completenesses as $completeness) {
         if ($completeness->getRatio() === 100) {
             $isComplete = true;
         }
     }
     return $isComplete;
 }
开发者ID:rskonieczka,项目名称:MagentoConnectorBundle,代码行数:16,代码来源:ProductAssociationProcessor.php


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