本文整理汇总了PHP中Pim\Bundle\CatalogBundle\Model\ProductValueInterface::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductValueInterface::__toString方法的具体用法?PHP ProductValueInterface::__toString怎么用?PHP ProductValueInterface::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pim\Bundle\CatalogBundle\Model\ProductValueInterface
的用法示例。
在下文中一共展示了ProductValueInterface::__toString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_normalizes_product_with_associations($filter, ProductInterface $product, AttributeInterface $skuAttribute, ProductValueInterface $sku, Association $myCrossSell, AssociationTypeInterface $crossSell, Association $myUpSell, AssociationTypeInterface $upSell, GroupInterface $associatedGroup1, GroupInterface $associatedGroup2, ProductInterface $associatedProduct1, ProductInterface $associatedProduct2, ProductValueInterface $skuAssocProduct1, ProductValueInterface $skuAssocProduct2, Collection $values, FamilyInterface $family, $serializer)
{
$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');
$crossSell->getCode()->willReturn('cross_sell');
$myCrossSell->getAssociationType()->willReturn($crossSell);
$myCrossSell->getGroups()->willReturn([]);
$myCrossSell->getProducts()->willReturn([]);
$upSell->getCode()->willReturn('up_sell');
$myUpSell->getAssociationType()->willReturn($upSell);
$associatedGroup1->getCode()->willReturn('associated_group1');
$associatedGroup2->getCode()->willReturn('associated_group2');
$myUpSell->getGroups()->willReturn([$associatedGroup1, $associatedGroup2]);
$skuAssocProduct1->getAttribute()->willReturn($skuAttribute);
$skuAssocProduct2->getAttribute()->willReturn($skuAttribute);
$skuAssocProduct1->__toString()->willReturn('sku_assoc_product1');
$skuAssocProduct2->__toString()->willReturn('sku_assoc_product2');
$associatedProduct1->getIdentifier()->willReturn($skuAssocProduct1);
$associatedProduct2->getIdentifier()->willReturn($skuAssocProduct2);
$myUpSell->getProducts()->willReturn([$associatedProduct1, $associatedProduct2]);
$product->getIdentifier()->willReturn($sku);
$product->getFamily()->willReturn($family);
$product->isEnabled()->willReturn(true);
$product->getGroupCodes()->willReturn('group1,group2,variant_group_1');
$product->getCategoryCodes()->willReturn('nice shoes, converse');
$product->getAssociations()->willReturn([$myCrossSell, $myUpSell]);
$product->getValues()->willReturn($values);
$filter->filterCollection($values, 'pim.transform.product_value.flat', Argument::cetera())->willReturn([$sku]);
$serializer->normalize($sku, 'flat', Argument::any())->willReturn(['sku' => 'sku-001']);
$this->normalize($product, 'flat', [])->shouldReturn(['sku' => 'sku-001', 'family' => 'shoes', 'groups' => 'group1,group2,variant_group_1', 'categories' => 'nice shoes, converse', 'cross_sell-groups' => '', 'cross_sell-products' => '', 'up_sell-groups' => 'associated_group1,associated_group2', 'up_sell-products' => 'sku_assoc_product1,sku_assoc_product2', 'enabled' => 1]);
}