當前位置: 首頁>>代碼示例>>PHP>>正文


PHP PromotionInterface::getCode方法代碼示例

本文整理匯總了PHP中Sylius\Component\Promotion\Model\PromotionInterface::getCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP PromotionInterface::getCode方法的具體用法?PHP PromotionInterface::getCode怎麽用?PHP PromotionInterface::getCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sylius\Component\Promotion\Model\PromotionInterface的用法示例。


在下文中一共展示了PromotionInterface::getCode方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getPromotionFieldsWithHeader

 /**
  * @param PromotionInterface $promotion
  * @param string $header
  *
  * @return NodeElement
  */
 private function getPromotionFieldsWithHeader(PromotionInterface $promotion, $header)
 {
     $tableAccessor = $this->getTableAccessor();
     $table = $this->getElement('table');
     $fields = $tableAccessor->getFieldFromRow($table, $tableAccessor->getRowWithFields($table, ['code' => $promotion->getCode()]), $header);
     return $fields;
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:13,代碼來源:IndexPage.php

示例2: removeUnitOrderPromotionAdjustmentsByOrigin

 /**
  * @param OrderItemUnitInterface $unit
  * @param PromotionInterface $promotion
  */
 private function removeUnitOrderPromotionAdjustmentsByOrigin(OrderItemUnitInterface $unit, PromotionInterface $promotion)
 {
     foreach ($unit->getAdjustments(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT) as $adjustment) {
         if ($promotion->getCode() === $adjustment->getOriginCode()) {
             $unit->removeAdjustment($adjustment);
         }
     }
 }
開發者ID:gabiudrescu,項目名稱:Sylius,代碼行數:12,代碼來源:DiscountAction.php

示例3: 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

示例4:

 function it_reverts_order_units_order_promotion_adjustments(AdjustmentInterface $firstAdjustment, AdjustmentInterface $secondAdjustment, OrderInterface $order, OrderItemInterface $item, OrderItemUnitInterface $unit, PromotionInterface $promotion)
 {
     $order->countItems()->willReturn(1);
     $order->getItems()->willReturn([$item]);
     $item->getUnits()->willReturn([$unit]);
     $unit->getAdjustments(AdjustmentInterface::ORDER_PROMOTION_ADJUSTMENT)->willReturn([$firstAdjustment, $secondAdjustment]);
     $promotion->getCode()->willReturn('PROMOTION');
     $firstAdjustment->getOriginCode()->willReturn('PROMOTION');
     $secondAdjustment->getOriginCode()->willReturn('OTHER_PROMOTION');
     $unit->removeAdjustment($firstAdjustment)->shouldBeCalled();
     $unit->removeAdjustment($secondAdjustment)->shouldNotBeCalled();
     $this->revert($order, [], $promotion);
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:13,代碼來源:PercentageDiscountPromotionActionCommandSpec.php

示例5: 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

示例6:

 function it_throws_exception_when_a_promotion_is_found_but_it_should_not_exist(PromotionInterface $promotion, PromotionRepositoryInterface $promotionRepository)
 {
     $promotion->getCode()->willReturn('christmas_promotion');
     $promotionRepository->findOneBy(['code' => 'christmas_promotion'])->willReturn($promotion);
     $this->shouldThrow(NotEqualException::class)->during('promotionShouldNotExistInTheRegistry', [$promotion]);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:6,代碼來源:PromotionContextSpec.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: promotionShouldNotExistInTheRegistry

 /**
  * @Then /^(this promotion) should no longer exist in the promotion registry$/
  */
 public function promotionShouldNotExistInTheRegistry(PromotionInterface $promotion)
 {
     Assert::null($this->promotionRepository->findOneBy(['code' => $promotion->getCode()]));
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:7,代碼來源:ManagingPromotionsContext.php

示例9: promotionShouldNotExistInTheRegistry

 /**
  * @Then /^(this promotion) should no longer exist in the promotion registry$/
  */
 public function promotionShouldNotExistInTheRegistry(PromotionInterface $promotion)
 {
     expect($this->promotionRepository->findOneBy(['code' => $promotion->getCode()]))->toBe(null);
 }
開發者ID:ahmadrabie,項目名稱:Sylius,代碼行數:7,代碼來源:PromotionContext.php


注:本文中的Sylius\Component\Promotion\Model\PromotionInterface::getCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。