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


PHP OrderInterface::getItems方法代碼示例

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


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

示例1:

 function it_returns_false_if_variant_is_not_included_and_exclude_is_not_set(OrderInterface $subject, OrderItem $orderItem, ProductVariant $variant)
 {
     $subject->getItems()->willReturn([$orderItem]);
     $orderItem->getVariant()->willReturn($variant);
     $variant->getId()->willReturn(2);
     $this->isEligible($subject, ['variant' => 1, 'exclude' => false])->shouldReturn(false);
 }
開發者ID:aleherse,項目名稱:Sylius,代碼行數:7,代碼來源:ContainsProductRuleCheckerSpec.php

示例2: holdInventory

 /**
  * {@inheritdoc}
  */
 public function holdInventory(OrderInterface $order)
 {
     foreach ($order->getItems() as $item) {
         $quantity = $this->applyTransition($item->getUnits(), InventoryUnitTransitions::SYLIUS_HOLD);
         $this->inventoryOperator->hold($item->getVariant(), $quantity);
     }
 }
開發者ID:TeamNovatek,項目名稱:Sylius,代碼行數:10,代碼來源:InventoryHandler.php

示例3:

 function it_executes_request(InvoiceNumberGeneratorInterface $invoiceNumberGenerator, CurrencyConverterInterface $currencyConverter, Convert $request, PaymentInterface $payment, OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $productVariant, ProductInterface $product)
 {
     $request->getTo()->willReturn('array');
     $payment->getId()->willReturn(19);
     $order->getId()->willReturn(92);
     $order->getId()->willReturn(92);
     $order->getCurrencyCode()->willReturn('PLN');
     $order->getTotal()->willReturn(22000);
     $order->getItems()->willReturn([$orderItem]);
     $order->getAdjustmentsTotalRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->willReturn(0);
     $order->getOrderPromotionTotal()->willReturn(0);
     $order->getShippingTotal()->willReturn(2000);
     $orderItem->getVariant()->willReturn($productVariant);
     $orderItem->getDiscountedUnitPrice()->willReturn(20000);
     $orderItem->getQuantity()->willReturn(1);
     $productVariant->getProduct()->willReturn($product);
     $product->getName()->willReturn('Lamborghini Aventador Model');
     $request->getSource()->willReturn($payment);
     $payment->getOrder()->willReturn($order);
     $invoiceNumberGenerator->generate($order, $payment)->willReturn('19-92');
     $currencyConverter->convertFromBase(22000, 'PLN')->willReturn(88000);
     $currencyConverter->convertFromBase(20000, 'PLN')->willReturn(80000);
     $currencyConverter->convertFromBase(2000, 'PLN')->willReturn(8000);
     $details = ['PAYMENTREQUEST_0_INVNUM' => '19-92', 'PAYMENTREQUEST_0_CURRENCYCODE' => 'PLN', 'PAYMENTREQUEST_0_AMT' => 880.0, 'PAYMENTREQUEST_0_ITEMAMT' => 880.0, 'L_PAYMENTREQUEST_0_NAME0' => 'Lamborghini Aventador Model', 'L_PAYMENTREQUEST_0_AMT0' => 800.0, 'L_PAYMENTREQUEST_0_QTY0' => 1, 'L_PAYMENTREQUEST_0_NAME1' => 'Shipping Total', 'L_PAYMENTREQUEST_0_AMT1' => 80.0, 'L_PAYMENTREQUEST_0_QTY1' => 1];
     $request->setResult($details)->shouldBeCalled();
     $this->execute($request);
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:27,代碼來源:ConvertPaymentActionSpec.php

示例4: decreaseSoldVariants

 /**
  * @param OrderInterface $order
  */
 public function decreaseSoldVariants(OrderInterface $order)
 {
     /** @var $item OrderItemInterface */
     foreach ($order->getItems() as $item) {
         $variant = $item->getVariant();
         $variant->setSold($variant->getSold() - $item->getQuantity());
     }
 }
開發者ID:aleherse,項目名稱:Sylius,代碼行數:11,代碼來源:CompleteOrderCallback.php

示例5:

 function it_returns_false_if_variant_is_included_and_count_is_set_bigger_amount_than_quantity(OrderInterface $subject, OrderItem $orderItem, ProductVariant $variant)
 {
     $subject->getItems()->willReturn([$orderItem]);
     $orderItem->getVariant()->willReturn($variant);
     $variant->getId()->willReturn(1);
     $orderItem->getPromotionSubjectCount()->willReturn(1);
     $this->isEligible($subject, ['variant' => 1, 'exclude' => false, 'count' => 2])->shouldReturn(false);
 }
開發者ID:bendavies,項目名稱:Sylius,代碼行數:8,代碼來源:ContainsProductRuleCheckerSpec.php

示例6:

 function it_returns_false_if_product_is_wrong(OrderInterface $subject, OrderItemInterface $firstOrderItem, OrderItemInterface $secondOrderItem, ProductInterface $shaft, ProductInterface $head)
 {
     $subject->getItems()->willReturn([$firstOrderItem, $secondOrderItem]);
     $firstOrderItem->getProduct()->willReturn($head);
     $secondOrderItem->getProduct()->willReturn($shaft);
     $head->getCode()->willReturn('LACROSSE_HEAD');
     $shaft->getCode()->willReturn('LACROSSE_SHAFT');
     $this->isEligible($subject, ['product_code' => 'LACROSSE_STRING'])->shouldReturn(false);
 }
開發者ID:loic425,項目名稱:Sylius,代碼行數:9,代碼來源:ContainsProductRuleCheckerSpec.php

示例7:

 function it_doesnt_apply_any_taxes_if_zone_is_missing(OrderInterface $order, Collection $collection, $taxationSettings)
 {
     $collection->isEmpty()->willReturn(false);
     $order->getItems()->willReturn($collection);
     $order->removeTaxAdjustments()->shouldBeCalled();
     $order->getShippingAddress()->willReturn(null);
     $taxationSettings->has('default_tax_zone')->willReturn(false);
     $order->addAdjustment(Argument::any())->shouldNotBeCalled();
     $this->applyTaxes($order);
 }
開發者ID:bcremer,項目名稱:Sylius,代碼行數:10,代碼來源:TaxationProcessorSpec.php

示例8:

 function it_throws_exception_when_recalculated_on_hand_quantity_is_lower_than_zero(OrderInterface $order, OrderItemInterface $orderItem, ProductVariantInterface $productVariant)
 {
     $order->getItems()->willReturn([$orderItem]);
     $orderItem->getQuantity()->willReturn(5);
     $orderItem->getVariant()->willReturn($productVariant);
     $productVariant->isTracked()->willReturn(true);
     $productVariant->getOnHand()->willReturn(4);
     $productVariant->getName()->willReturn('Variant');
     $this->shouldThrow(\InvalidArgumentException::class)->during('decrease', [$order]);
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:10,代碼來源:OnHandQuantityUpdaterSpec.php

示例9:

 function it_should_recognize_subject_as_not_eligible_if_product_taxonomy_is_matched_and_exclude_is_set(OrderInterface $subject, OrderItemInterface $item, Taxon $taxon, Product $product, ArrayCollection $collection)
 {
     $configuration = ['taxons' => $collection, 'exclude' => true];
     $collection->contains(2)->willReturn(true);
     $taxon->getId()->willReturn(2);
     $product->getTaxons()->willReturn([$taxon]);
     $item->getProduct()->willReturn($product);
     $subject->getItems()->willReturn([$item]);
     $this->isEligible($subject, $configuration)->shouldReturn(false);
 }
開發者ID:vikey89,項目名稱:Sylius,代碼行數:10,代碼來源:TaxonomyRuleCheckerSpec.php

示例10: decrease

 /**
  * {@inheritdoc}
  */
 public function decrease(OrderInterface $order)
 {
     /** @var OrderItemInterface $orderItem */
     foreach ($order->getItems() as $orderItem) {
         $variant = $orderItem->getVariant();
         if ($variant->isTracked()) {
             Assert::greaterThanEq($variant->getOnHold() - $orderItem->getQuantity(), 0, sprintf('Not enough units to decrease the inventory of a variant "%s".', $variant->getName()));
             $variant->setOnHold($variant->getOnHold() - $orderItem->getQuantity());
         }
     }
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:14,代碼來源:OnHoldQuantityUpdater.php

示例11: giveBack

 /**
  * @param OrderInterface $order
  */
 private function giveBack(OrderInterface $order)
 {
     /** @var OrderItemInterface $orderItem */
     foreach ($order->getItems() as $orderItem) {
         $variant = $orderItem->getVariant();
         if (!$variant->isTracked()) {
             continue;
         }
         $variant->setOnHand($variant->getOnHand() + $orderItem->getQuantity());
     }
 }
開發者ID:starspire,項目名稱:Sylius,代碼行數:14,代碼來源:OrderInventoryOperator.php

示例12: apply

 /**
  * {@inheritdoc}
  */
 public function apply(OrderInterface $order, PromotionInterface $promotion, array $adjustmentsAmounts)
 {
     Assert::eq($order->countItems(), count($adjustmentsAmounts));
     $i = 0;
     foreach ($order->getItems() as $item) {
         $adjustmentAmount = $adjustmentsAmounts[$i++];
         if (0 === $adjustmentAmount) {
             continue;
         }
         $this->applyAdjustmentsOnItemUnits($item, $promotion, $adjustmentAmount);
     }
 }
開發者ID:ReissClothing,項目名稱:Sylius,代碼行數:15,代碼來源:UnitsPromotionAdjustmentsApplicator.php

示例13:

 function it_does_not_recognize_a_subject_as_eligible_if_items_from_required_taxon_has_too_low_total(TaxonRepositoryInterface $taxonRepository, OrderInterface $order, OrderItemInterface $compositeBowItem, OrderItemInterface $longswordItem, ProductInterface $compositeBow, ProductInterface $longsword, TaxonInterface $bows)
 {
     $order->getItems()->willReturn([$compositeBowItem, $longswordItem]);
     $taxonRepository->findOneBy(['code' => 'bows'])->willReturn($bows);
     $compositeBowItem->getProduct()->willReturn($compositeBow);
     $compositeBow->hasTaxon($bows)->willReturn(true);
     $compositeBowItem->getTotal()->willReturn(5000);
     $longswordItem->getProduct()->willReturn($longsword);
     $longsword->hasTaxon($bows)->willReturn(false);
     $longswordItem->getTotal()->willReturn(4000);
     $this->isEligible($order, ['taxon' => 'bows', 'amount' => 10000])->shouldReturn(false);
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:12,代碼來源:TotalOfItemsFromTaxonRuleCheckerSpec.php

示例14:

 function it_does_not_check_an_item_if_its_product_has_no_required_taxon(OrderInterface $order, OrderItemInterface $compositeBowItem, OrderItemInterface $longswordItem, ProductInterface $compositeBow, ProductInterface $longsword, TaxonInterface $bows, TaxonRepositoryInterface $taxonRepository)
 {
     $order->getItems()->willReturn(new \ArrayIterator([$compositeBowItem->getWrappedObject(), $longswordItem->getWrappedObject()]));
     $taxonRepository->findOneBy(['code' => 'bows'])->willReturn($bows);
     $compositeBowItem->getProduct()->willReturn($compositeBow);
     $compositeBow->hasTaxon($bows)->willReturn(true);
     $compositeBowItem->getQuantity()->willReturn(4);
     $longswordItem->getProduct()->willReturn($longsword);
     $longsword->hasTaxon($bows)->willReturn(false);
     $longswordItem->getQuantity()->shouldNotBeCalled();
     $this->isEligible($order, ['taxon' => 'bows', 'count' => 5])->shouldReturn(false);
 }
開發者ID:loic425,項目名稱:Sylius,代碼行數:12,代碼來源:ContainsTaxonRuleCheckerSpec.php

示例15:

 function it_recalculates_prices_without_adding_anything_to_the_context_if_its_not_needed(DelegatingCalculatorInterface $priceCalculator, OrderInterface $order, OrderItemInterface $item, PriceableInterface $variant)
 {
     $order->getCustomer()->willReturn(null);
     $order->getChannel()->willReturn(null);
     $order->getItems()->willReturn([$item]);
     $item->isImmutable()->willReturn(false);
     $item->getQuantity()->willReturn(5);
     $item->getVariant()->willReturn($variant);
     $priceCalculator->calculate($variant, ['quantity' => 5])->willReturn(10);
     $item->setUnitPrice(10)->shouldBeCalled();
     $this->process($order);
 }
開發者ID:TheMadeleine,項目名稱:Sylius,代碼行數:12,代碼來源:OrderPricesRecalculatorSpec.php


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