コード例 #1
0
ファイル: AddProductAction.php プロジェクト: bcremer/Sylius
 /**
  * {@inheritdoc}
  */
 public function revert(PromotionSubjectInterface $subject, array $configuration, PromotionInterface $promotion)
 {
     if ($subject instanceof OrderItemInterface) {
         return;
     }
     if (!$subject instanceof OrderInterface) {
         throw new UnexpectedTypeException($subject, 'Sylius\\Component\\Order\\Model\\OrderInterface');
     }
     $promotionItem = $this->createItem($configuration);
     foreach ($subject->getItems() as $item) {
         if ($item->equals($promotionItem)) {
             $subject->removeItem($item);
         }
     }
 }
コード例 #2
0
ファイル: AddProductAction.php プロジェクト: Silwereth/Sylius
 /**
  * {@inheritdoc}
  */
 public function revert(PromotionSubjectInterface $subject, array $configuration, PromotionInterface $promotion)
 {
     if ($subject instanceof OrderItemInterface) {
         return;
     }
     if (!$subject instanceof OrderInterface) {
         throw new UnexpectedTypeException($subject, OrderInterface::class);
     }
     $promotionItem = $this->createItem($configuration);
     $promotionItem->setImmutable(true);
     foreach ($subject->getItems() as $item) {
         if ($item->equals($promotionItem)) {
             $subject->removeItem($item);
         }
     }
 }