本文整理汇总了PHP中Pim\Bundle\CatalogBundle\Model\ProductValueInterface::getPrices方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductValueInterface::getPrices方法的具体用法?PHP ProductValueInterface::getPrices怎么用?PHP ProductValueInterface::getPrices使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pim\Bundle\CatalogBundle\Model\ProductValueInterface
的用法示例。
在下文中一共展示了ProductValueInterface::getPrices方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_returns_a_price_collection_even_if_the_data_is_empty($productBuilder, ProductValueInterface $priceValue, ProductPriceInterface $price, ArrayCollection $priceCollection)
{
$productBuilder->addPriceForCurrency(Argument::cetera())->willReturn($price);
$priceValue->addPrice($price)->shouldBeCalled();
$priceValue->getPrices()->willReturn($priceCollection);
$context = ['value' => $priceValue, 'price_currency' => 'WillNotBeUsed'];
$this->denormalize('', 'className', null, $context)->shouldReturn($priceCollection);
$this->denormalize(null, 'className', null, $context)->shouldReturn($priceCollection);
}
示例2:
function it_normalizes_product_with_price($filter, ProductInterface $product, AttributeInterface $priceAttribute, ProductValueInterface $price, Collection $prices, Collection $values, ProductPriceInterface $productPrice, FamilyInterface $family, SerializerInterface $serializer)
{
$family->getCode()->willReturn('shoes');
$priceAttribute->getCode()->willReturn('price');
$priceAttribute->getAttributeType()->willReturn('pim_catalog_price_collection');
$priceAttribute->isLocalizable()->willReturn(false);
$priceAttribute->isScopable()->willReturn(false);
$price->getAttribute()->willReturn($priceAttribute);
$price->getData()->willReturn(null);
$productPrice->getData()->willReturn("356.00");
$productPrice->getCurrency()->willReturn("EUR");
$prices->add($productPrice);
$price->getPrices()->willReturn($prices);
$product->getIdentifier()->willReturn($price);
$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([]);
$values->add($price);
$product->getValues()->willReturn($values);
$filter->filterCollection($values, 'pim.transform.product_value.flat', Argument::cetera())->willReturn([$price]);
$serializer->normalize($price, 'flat', Argument::any())->willReturn(['price-EUR' => '356.00']);
$this->normalize($product, 'flat', ['price-EUR' => ''])->shouldReturn(['price-EUR' => '356.00', 'family' => 'shoes', 'groups' => 'group1, group2, variant_group_1', 'categories' => 'nice shoes, converse', 'enabled' => 1]);
}
示例3: getPriceForCurrency
/**
* @param ProductValueInterface $value
* @param string $currency
*
* @return null|ProductPriceInterface
*/
protected function getPriceForCurrency(ProductValueInterface $value, $currency)
{
foreach ($value->getPrices() as $price) {
if ($currency === $price->getCurrency()) {
return $price;
}
}
return null;
}
示例4: setProductPrice
/**
* @param ProductValueInterface $productValue
* @param ProductValueInterface $value
*/
protected function setProductPrice(ProductValueInterface $productValue, ProductValueInterface $value)
{
foreach ($value->getPrices() as $price) {
if (null === ($productPrice = $productValue->getPrice($price->getCurrency()))) {
$productPrice = $this->productBuilder->addPriceForCurrency($productValue, $price->getCurrency());
}
$productPrice->setData($price->getData());
}
}