本文整理匯總了PHP中Pim\Bundle\CatalogBundle\Model\ProductValueInterface::getDecimal方法的典型用法代碼示例。如果您正苦於以下問題:PHP ProductValueInterface::getDecimal方法的具體用法?PHP ProductValueInterface::getDecimal怎麽用?PHP ProductValueInterface::getDecimal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pim\Bundle\CatalogBundle\Model\ProductValueInterface
的用法示例。
在下文中一共展示了ProductValueInterface::getDecimal方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
function it_returns_flat_data_with_french_attribute($channelManager, $serializer, $dateformatProvider, $numberFormatProvider, ChannelInterface $channel, ProductInterface $product, ProductValueInterface $number, AttributeInterface $attribute, MetricInterface $metric, ProductValueInterface $metricValue, ProductPriceInterface $price, ProductValueInterface $priceValue)
{
$dateformatProvider->getFormat('fr_FR')->willReturn('d/m/Y');
$numberFormatProvider->getFormat('fr_FR')->willReturn(['decimal_separator' => ',']);
$this->configureOptions('fr_FR');
$attribute->getAttributeType()->willReturn('pim_catalog_number');
$number->getDecimal('10.50');
$number->getAttribute()->willReturn($attribute);
$attribute->getAttributeType()->willReturn('pim_catalog_metric');
$metric->getData()->willReturn('10.00');
$metric->getUnit()->willReturn('GRAM');
$metricValue->getAttribute()->willReturn($attribute);
$metricValue->getData()->willReturn($metric);
$attribute->getAttributeType()->willReturn('pim_catalog_price_collection');
$price->getData()->willReturn('10');
$price->getCurrency()->willReturn('EUR');
$priceValue->getAttribute()->willReturn($attribute);
$priceValue->getData()->willReturn($price);
$product->getValues()->willReturn([$number, $metricValue, $priceValue]);
$serializer->normalize($product, 'flat', ['scopeCode' => 'mobile', 'localeCodes' => '', 'decimal_separator' => ',', 'date_format' => 'd/m/Y'])->willReturn(['10,50', '10,00 GRAM', '10,00 EUR', '25/10/2015']);
$channelManager->getChannelByCode('mobile')->willReturn($channel);
$this->setChannelCode('mobile');
$this->process($product)->shouldReturn(['media' => [], 'product' => ['10,50', '10,00 GRAM', '10,00 EUR', '25/10/2015']]);
}