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


PHP ProductInterface::getIdentifier方法代码示例

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


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

示例1:

 function it_gets_association_status_for_a_given_product($magentoSoapClient, ProductInterface $product)
 {
     $magentoSoapClient->call('catalog_product_link.list', ['up_sell', 'sku-012', 'sku'])->willReturn('up_sell');
     $magentoSoapClient->call('catalog_product_link.list', ['cross_sell', 'sku-012', 'sku'])->willReturn('cross_sell');
     $magentoSoapClient->call('catalog_product_link.list', ['related', 'sku-012', 'sku'])->willReturn('related');
     $magentoSoapClient->call('catalog_product_link.list', ['grouped', 'sku-012', 'sku'])->willReturn('grouped');
     $product->getIdentifier()->willReturn('sku-012');
     $this->getAssociationsStatus($product)->shouldReturn(['up_sell' => 'up_sell', 'cross_sell' => 'cross_sell', 'related' => 'related', 'grouped' => 'grouped']);
 }
开发者ID:jarocks,项目名称:MagentoConnectorBundle,代码行数:9,代码来源:WebserviceSpec.php

示例2:

 function it_generates_association_calls_for_given_products($webservice, ProductInterface $product, ProductInterface $associatedProduct, Association $association, AssociationType $associationType)
 {
     $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');
     $associationType->getCode()->willReturn('UPSELL');
     $this->process([$product])->shouldReturn(['remove' => [['type' => 'cross_sell', 'product' => 'sku-012', 'linkedProduct' => 'sku-011', 'identifierType' => 'sku']], 'create' => [['type' => 'up_sell', 'product' => 'sku-012', 'linkedProduct' => 'sku-011', 'identifierType' => 'sku']]]);
 }
开发者ID:jarocks,项目名称:MagentoConnectorBundle,代码行数:11,代码来源:ProductAssociationProcessorSpec.php

示例3:

 function it_does_not_validate_products_with_multiple_variant_group($context, $onlyOneVariantGroup, ProductInterface $mug, CustomGroupInterface $mugVariantGroup, CustomGroupInterface $otherGroup, GroupTypeInterface $variantType)
 {
     $mug->getGroups()->willReturn([$mugVariantGroup, $otherGroup]);
     $mugVariantGroup->getType()->willReturn($variantType);
     $mugVariantGroup->__toString()->willReturn('mug');
     $otherGroup->getType()->willReturn($variantType);
     $otherGroup->__toString()->willReturn('other');
     $variantType->isVariant()->willReturn(true);
     $mug->getIdentifier()->willReturn('mug');
     $context->addViolation($onlyOneVariantGroup->message, ['%groups%' => 'mug, other', '%product%' => 'mug'])->shouldBeCalled();
     $this->validate($mug, $onlyOneVariantGroup);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:12,代码来源:UniqueVariantGroupValidatorSpec.php

示例4:

 function it_throws_an_exception_if_no_file_is_found(ChannelInterface $channel, ProductInterface $product, ChannelManager $channelManager, Serializer $serializer, ProductValueInterface $productValue, AttributeInterface $attribute)
 {
     $product->getValues()->willReturn([$productValue]);
     $productValue->getAttribute()->willReturn($attribute);
     $attribute->getAttributeType()->willReturn('pim_catalog_image');
     $product->getIdentifier()->willReturn($productValue);
     $productValue->getData()->willReturn('data');
     $this->setChannel('foobar');
     $channelManager->getChannelByCode('foobar')->willReturn($channel);
     $serializer->normalize(['data'], 'flat', ['field_name' => 'media', 'prepare_copy' => true])->willThrow('Symfony\\Component\\HttpFoundation\\File\\Exception\\FileNotFoundException');
     $this->shouldThrow('Akeneo\\Bundle\\BatchBundle\\Item\\InvalidItemException')->during('process', [$product]);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:12,代码来源:ProductToFlatArrayProcessorSpec.php

示例5:

 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:noglitchyo,项目名称:pim-community-dev,代码行数:14,代码来源:HasVariantAxesValidatorSpec.php

示例6:

 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

示例7:

 function it_generates_warning_message_if_there_is_products_in_a_variant_group($groupRepository, $productMassActionRepo, CustomGroupInterface $shoes, ProductInterface $product1, ProductInterface $product2)
 {
     $product1->getVariantGroup()->willReturn(null);
     $product1->getIdentifier()->shouldNotBeCalled();
     $product2->getVariantGroup()->willReturn($shoes);
     $product2->getIdentifier()->shouldBeCalled()->willReturn('shirt_000');
     $this->setObjectsToMassEdit([$product1, $product2]);
     $product1->getId()->willReturn(1);
     $product2->getId()->willReturn(2);
     $productMassActionRepo->findCommonAttributeIds(Argument::type('array'))->willReturn([]);
     $groupRepository->getVariantGroupsByAttributeIds([])->willReturn([$shoes]);
     $shoes->getId()->willReturn(42);
     $groupRepository->getVariantGroupsByIds([42], false)->willReturn([]);
     $groupRepository->countVariantGroups()->willReturn(1);
     $this->getFormOptions();
     $this->getWarningMessages()->shouldReturn([['key' => 'pim_enrich.mass_edit_action.add-to-variant-group.already_in_variant_group_or_not_valid', 'options' => ['%products%' => 'shirt_000']]]);
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:17,代码来源:AddToVariantGroupSpec.php

示例8: ArrayCollection

 function it_updates_a_variant_group($attributeRepository, $groupTypeRepository, $productBuilder, GroupInterface $variantGroup, AttributeInterface $attribute, GroupTypeInterface $type, GroupTranslation $translatable, ProductInterface $product, ProductValueInterface $productValue, 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();
     $product->getValues()->willReturn(new ArrayCollection([$productValue]));
     $product->getIdentifier()->willReturn($productValue);
     $productBuilder->createProduct()->willReturn($product);
     $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:CopeX,项目名称:pim-community-dev,代码行数:23,代码来源:VariantGroupUpdaterSpec.php

示例9:

 function it_returns_flat_data_with_media($channelManager, Filesystem $filesystem, ChannelInterface $channel, ProductInterface $product, FileInterface $media1, FileInterface $media2, ProductValueInterface $value1, ProductValueInterface $value2, AttributeInterface $attribute, ProductValueInterface $identifierValue, AttributeInterface $identifierAttribute, $serializer)
 {
     $media1->getKey()->willReturn('key/to/media1.jpg');
     $media2->getKey()->willReturn('key/to/media2.jpg');
     $value1->getAttribute()->willReturn($attribute);
     $value1->getMedia()->willReturn($media1);
     $value2->getAttribute()->willReturn($attribute);
     $value2->getMedia()->willReturn($media2);
     $attribute->getAttributeType()->willReturn('pim_catalog_image');
     $product->getValues()->willReturn([$value1, $value2, $identifierValue]);
     $identifierValue->getAttribute()->willReturn($identifierAttribute);
     $identifierAttribute->getAttributeType()->willReturn('pim_catalog_identifier');
     $product->getIdentifier()->willReturn($identifierValue);
     $identifierValue->getData()->willReturn('data');
     $filesystem->has('key/to/media1.jpg')->willReturn(true);
     $filesystem->has('key/to/media2.jpg')->willReturn(true);
     $serializer->normalize($media1, 'flat', ['field_name' => 'media', 'prepare_copy' => true, 'value' => $value1])->willReturn(['normalized_media1']);
     $serializer->normalize($media2, 'flat', ['field_name' => 'media', 'prepare_copy' => true, 'value' => $value2])->willReturn(['normalized_media2']);
     $serializer->normalize($product, 'flat', ['scopeCode' => 'foobar', 'localeCodes' => ''])->willReturn(['normalized_product']);
     $channelManager->getChannelByCode('foobar')->willReturn($channel);
     $this->setChannel('foobar');
     $this->process($product)->shouldReturn(['media' => [['normalized_media1'], ['normalized_media2']], 'product' => ['normalized_product']]);
 }
开发者ID:umpirsky,项目名称:pim-community-dev,代码行数:23,代码来源:ProductToFlatArrayProcessorSpec.php

示例10: generateFilenamePrefix

 /**
  * @param ProductInterface      $product
  * @param ProductValueInterface $value
  *
  * @return string
  */
 public function generateFilenamePrefix(ProductInterface $product, ProductValueInterface $value)
 {
     return sprintf('%s-%s-%s-%s-%s-%s', $product->getId(), Urlizer::urlize($product->getIdentifier(), '_'), $value->getAttribute()->getCode(), $value->getLocale(), $value->getScope(), time());
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:10,代码来源:MediaManager.php

示例11: getRemoveCallsForProduct

 /**
  * Get remove association calls for a given product.
  *
  * @param ProductInterface $product
  * @param array            $associationStatus
  *
  * @return array
  */
 protected function getRemoveCallsForProduct(ProductInterface $product, array $associationStatus)
 {
     $removeAssociationCalls = [];
     foreach ($associationStatus as $associationType => $associatedProducts) {
         foreach ($associatedProducts as $associatedProduct) {
             $removeAssociationCalls[] = ['type' => $associationType, 'product' => (string) $product->getIdentifier(), 'linkedProduct' => (string) $associatedProduct['sku'], 'identifierType' => 'sku'];
         }
     }
     return $removeAssociationCalls;
 }
开发者ID:mejdoubimeriem,项目名称:prestashopconnector,代码行数:18,代码来源:ProductAssociationProcessor.php

示例12:

 function it_normalizes_product_with_a_multiselect_value($filter, $serializer, ProductInterface $product, AbstractAttribute $skuAttribute, AbstractAttribute $colorsAttribute, AbstractProductValue $sku, AbstractProductValue $colors, AttributeOption $red, AttributeOption $blue, Collection $values, Family $family)
 {
     $family->getCode()->willReturn('shoes');
     $skuAttribute->getCode()->willReturn('sku');
     $skuAttribute->getAttributeType()->willReturn('pim_catalog_identifier');
     $skuAttribute->isLocalizable()->willReturn(false);
     $skuAttribute->isScopable()->willReturn(false);
     $sku->getAttribute()->willReturn($skuAttribute);
     $sku->getData()->willReturn('sku-001');
     $colorsAttribute->getCode()->willReturn('colors');
     $colorsAttribute->isLocalizable()->willReturn(false);
     $colorsAttribute->isScopable()->willReturn(false);
     $colors->getAttribute()->willReturn($colorsAttribute);
     $colors->getData()->willReturn([$red, $blue]);
     $product->getIdentifier()->willReturn($sku);
     $product->getFamily()->willReturn($family);
     $product->isEnabled()->willReturn(true);
     $product->getGroupCodes()->willReturn('');
     $product->getCategoryCodes()->willReturn('');
     $product->getAssociations()->willReturn([]);
     $product->getValues()->willReturn($values);
     $filter->filter($values, ['identifier' => $sku, 'scopeCode' => null, 'localeCodes' => []])->willReturn([$sku, $colors]);
     $serializer->normalize($sku, 'flat', Argument::any())->willReturn(['sku' => 'sku-001']);
     $serializer->normalize($colors, 'flat', Argument::any())->willReturn(['colors' => 'red, blue']);
     $this->normalize($product, 'flat', [])->shouldReturn(['sku' => 'sku-001', 'family' => 'shoes', 'groups' => '', 'categories' => '', 'colors' => 'red, blue', 'enabled' => 1]);
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:26,代码来源:ProductNormalizerSpec.php

示例13: prepareQueryCriterias

 /**
  * Prepare query criteria for variant group
  *
  * @param GroupInterface   $variantGroup
  * @param ProductInterface $product
  * @param Constraint       $constraint
  *
  * @return array
  */
 protected function prepareQueryCriterias(GroupInterface $variantGroup, ProductInterface $product, Constraint $constraint)
 {
     $criteria = [];
     foreach ($variantGroup->getAxisAttributes() as $attribute) {
         $value = $product->getValue($attribute->getCode());
         // we don't add criteria when option is null, as this check is performed by HasVariantAxesValidator
         if (null === $value || null === $value->getOption() && !$attribute->isBackendTypeReferenceData()) {
             $this->addEmptyAxisViolation($constraint, $variantGroup->getLabel(), $product->getIdentifier()->getVarchar(), $attribute->getCode());
             continue;
         }
         $current = ['attribute' => $attribute];
         if (null !== $value->getOption()) {
             $current['option'] = $value->getOption();
         } elseif ($attribute->isBackendTypeReferenceData()) {
             $current['referenceData'] = ['name' => $attribute->getReferenceDataName(), 'data' => $value->getData()];
         }
         $criteria[] = $current;
     }
     return $criteria;
 }
开发者ID:noglitchyo,项目名称:pim-community-dev,代码行数:29,代码来源:UniqueVariantAxisValidator.php

示例14: attributeSetChanged

 /**
  * Test if the product attribute set changed.
  *
  * @param ProductInterface $product
  * @param array            $prestashopProducts
  *
  * @return bool
  */
 protected function attributeSetChanged(ProductInterface $product, $prestashopProducts)
 {
     foreach ($prestashopProducts as $prestashopProduct) {
         if ($prestashopProduct['sku'] == $product->getIdentifier()->getData() && $prestashopProduct['set'] != $this->getAttributeSetId($product->getFamily()->getCode(), $product)) {
             return true;
         }
     }
     return false;
 }
开发者ID:mejdoubimeriem,项目名称:prestashopconnector,代码行数:17,代码来源:ProductProcessor.php

示例15: getReference

 /**
  * {@inheritdoc}
  */
 public function getReference()
 {
     return $this->owner ? $this->owner->getIdentifier() . '.' . $this->associationType->getCode() : null;
 }
开发者ID:javiersantos,项目名称:pim-community-dev,代码行数:7,代码来源:AbstractAssociation.php


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