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


PHP PromotionInterface::getName方法代码示例

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


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

示例1: createForPromotion

 /**
  * {@inheritdoc}
  */
 public function createForPromotion(PromotionInterface $promotion)
 {
     Assert::true($promotion->isCouponBased(), sprintf('Promotion with name %s is not coupon based.', $promotion->getName()));
     $coupon = $this->factory->createNew();
     $coupon->setPromotion($promotion);
     return $coupon;
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:CouponFactory.php

示例2:

 function it_creates_a_coupon_and_assigns_a_promotion_to_id(FactoryInterface $factory, PromotionInterface $promotion, PromotionCouponInterface $coupon)
 {
     $factory->createNew()->willReturn($coupon);
     $promotion->getName()->willReturn('Christmas sale');
     $promotion->isCouponBased()->willReturn(true);
     $coupon->setPromotion($promotion)->shouldBeCalled();
     $this->createForPromotion($promotion)->shouldReturn($coupon);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:8,代码来源:PromotionCouponFactorySpec.php

示例3: createAdjustment

 /**
  * @param PromotionInterface $promotion
  * @param string $type
  *
  * @return AdjustmentInterface
  */
 protected function createAdjustment(PromotionInterface $promotion, $type = AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT)
 {
     $adjustment = $this->adjustmentFactory->createNew();
     $adjustment->setType($type);
     $adjustment->setLabel($promotion->getName());
     $this->originator->setOrigin($adjustment, $promotion);
     return $adjustment;
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:14,代码来源:DiscountAction.php

示例4: createAdjustment

 /**
  * @param PromotionInterface $promotion
  * @param string $type
  *
  * @return AdjustmentInterface
  */
 protected function createAdjustment(PromotionInterface $promotion, $type = AdjustmentInterface::ORDER_SHIPPING_PROMOTION_ADJUSTMENT)
 {
     /** @var AdjustmentInterface $adjustment */
     $adjustment = $this->adjustmentFactory->createNew();
     $adjustment->setType($type);
     $adjustment->setLabel($promotion->getName());
     $adjustment->setOriginCode($promotion->getCode());
     return $adjustment;
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:15,代码来源:ShippingPercentageDiscountPromotionActionCommand.php

示例5:

 function it_applies_percentage_discount_as_promotion_adjustment(FactoryInterface $adjustmentFactory, $originator, OrderInterface $order, AdjustmentInterface $adjustment, PromotionInterface $promotion)
 {
     $order->getPromotionSubjectTotal()->willReturn(10000);
     $adjustmentFactory->createNew()->willReturn($adjustment);
     $promotion->getName()->willReturn('Test promotion');
     $adjustment->setAmount(-2500)->shouldBeCalled();
     $adjustment->setType(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT)->shouldBeCalled();
     $adjustment->setLabel('Test promotion')->shouldBeCalled();
     $originator->setOrigin($adjustment, $promotion)->shouldBeCalled();
     $order->addAdjustment($adjustment)->shouldBeCalled();
     $configuration = ['percentage' => 0.25];
     $this->execute($order, $configuration, $promotion);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:13,代码来源:PercentageDiscountActionSpec.php

示例6: addAdjustment

 /**
  * @param PromotionInterface $promotion
  * @param OrderItemUnitInterface $unit
  * @param int $amount
  */
 private function addAdjustment(PromotionInterface $promotion, OrderItemUnitInterface $unit, $amount)
 {
     $adjustment = $this->adjustmentFactory->createWithData(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT, $promotion->getName(), $amount);
     $adjustment->setOriginCode($promotion->getCode());
     $unit->addAdjustment($adjustment);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:11,代码来源:UnitsPromotionAdjustmentsApplicator.php

示例7: ArrayCollection

 function it_does_not_distribute_0_amount_to_unit_even_if_its_middle_element(AdjustmentFactoryInterface $adjustmentFactory, AdjustmentInterface $adjustment, IntegerDistributorInterface $distributor, OrderInterface $order, OrderItemInterface $coltItem, OrderItemUnitInterface $firstColtUnit, OrderItemUnitInterface $secondColtUnit, PromotionInterface $promotion)
 {
     $order->countItems()->willReturn(1);
     $order->getItems()->willReturn(new ArrayCollection([$coltItem->getWrappedObject()]));
     $coltItem->getQuantity()->willReturn(2);
     $distributor->distribute(1, 2)->willReturn([1, 0]);
     $coltItem->getUnits()->willReturn(new ArrayCollection([$firstColtUnit->getWrappedObject(), $secondColtUnit->getWrappedObject()]));
     $promotion->getName()->willReturn('Winter guns promotion!');
     $promotion->getCode()->willReturn('WINTER_GUNS_PROMOTION');
     $adjustmentFactory->createWithData(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT, 'Winter guns promotion!', 1)->willReturn($adjustment);
     $adjustment->setOriginCode('WINTER_GUNS_PROMOTION')->shouldBeCalled();
     $firstColtUnit->addAdjustment($adjustment)->shouldBeCalled();
     $secondColtUnit->addAdjustment(Argument::any())->shouldNotBeCalled();
     $this->apply($order, $promotion, [1]);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:15,代码来源:UnitsPromotionAdjustmentsApplicatorSpec.php

示例8:

 function it_gets_promotion_by_its_name(PromotionRepositoryInterface $promotionRepository, PromotionInterface $promotion)
 {
     $promotion->getName()->willReturn('Best Promotion');
     $promotionRepository->findOneBy(['name' => 'Best Promotion'])->willReturn($promotion);
     $this->getPromotionByName('Best Promotion');
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:6,代码来源:PromotionContextSpec.php


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