本文整理汇总了PHP中Sylius\Component\Core\Model\OrderInterface::getPromotions方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderInterface::getPromotions方法的具体用法?PHP OrderInterface::getPromotions怎么用?PHP OrderInterface::getPromotions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\Core\Model\OrderInterface
的用法示例。
在下文中一共展示了OrderInterface::getPromotions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_decrements_a_usage_of_promotions_applied_on_order(OrderInterface $order, PromotionInterface $firstPromotion, PromotionInterface $secondPromotion)
{
$order->getPromotions()->willReturn([$firstPromotion, $secondPromotion]);
$firstPromotion->decrementUsed()->shouldBeCalled();
$secondPromotion->decrementUsed()->shouldBeCalled();
$this->decrement($order);
}
示例2:
function it_decrements_promotion_usage_if_promotion_was_used(OrderInterface $order, PromotionInterface $promotion)
{
$order->getPromotions()->willReturn([$promotion]);
$promotion->getUsed()->willReturn(5);
$promotion->setUsed(4)->shouldBeCalled();
$this->decrementPromotionUsage($order);
}
示例3: decrement
/**
* {@inheritdoc}
*/
public function decrement(OrderInterface $order)
{
foreach ($order->getPromotions() as $promotion) {
$promotion->decrementUsed();
}
$promotionCoupon = $order->getPromotionCoupon();
if (null !== $promotionCoupon) {
$promotionCoupon->decrementUsed();
}
}
示例4: decrement
/**
* {@inheritdoc}
*/
public function decrement(OrderInterface $order)
{
foreach ($order->getPromotions() as $promotion) {
$promotion->decrementUsed();
}
}
示例5: decrementPromotionUsage
/**
* @param OrderInterface $order
*/
public function decrementPromotionUsage(OrderInterface $order)
{
foreach ($order->getPromotions() as $promotion) {
$promotion->setUsed($promotion->getUsed() - 1);
}
}