本文整理汇总了PHP中Sylius\Component\Core\Model\OrderInterface::isEmpty方法的典型用法代码示例。如果您正苦于以下问题:PHP OrderInterface::isEmpty方法的具体用法?PHP OrderInterface::isEmpty怎么用?PHP OrderInterface::isEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\Core\Model\OrderInterface
的用法示例。
在下文中一共展示了OrderInterface::isEmpty方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_does_not_process_taxes_if_there_is_no_tax_zone(ZoneProviderInterface $defaultTaxZoneProvider, ZoneMatcherInterface $zoneMatcher, PrioritizedServiceRegistryInterface $strategyRegistry, OrderInterface $order, OrderItemInterface $orderItem, AddressInterface $address)
{
$order->getItems()->willReturn([$orderItem]);
$order->isEmpty()->willReturn(false);
$order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
$orderItem->removeAdjustmentsRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
$order->getShippingAddress()->willReturn($address);
$zoneMatcher->match($address)->willReturn(null);
$defaultTaxZoneProvider->getZone($order)->willReturn(null);
$strategyRegistry->all()->shouldNotBeCalled();
$this->process($order);
}
示例2:
function it_adds_new_item_units_to_existing_shipment(OrderInterface $order, ShipmentInterface $shipment, Collection $shipments, OrderItemUnitInterface $itemUnit, OrderItemUnitInterface $itemUnitWithoutShipment)
{
$shipments->first()->willReturn($shipment);
$order->isEmpty()->willReturn(false);
$order->hasShipments()->willReturn(true);
$order->getItemUnits()->willReturn([$itemUnit, $itemUnitWithoutShipment]);
$order->getShipments()->willReturn($shipments);
$itemUnit->getShipment()->willReturn($shipment);
$shipment->addUnit($itemUnitWithoutShipment)->shouldBeCalled();
$shipment->addUnit($itemUnit)->shouldNotBeCalled();
$this->process($order);
}
示例3: process
/**
* {@inheritdoc}
*/
public function process(OrderInterface $order)
{
if ($order->isEmpty()) {
$order->removeShipments();
return;
}
$shipment = $this->getOrderShipment($order);
if (null === $shipment) {
return;
}
foreach ($order->getItemUnits() as $itemUnit) {
if (null === $itemUnit->getShipment()) {
$shipment->addUnit($itemUnit);
}
}
}
示例4:
function it_does_not_apply_taxes_if_there_is_no_tax_zone($defaultTaxZoneProvider, $zoneMatcher, $orderItemsTaxesApplicator, AddressInterface $address, \Iterator $iterator, Collection $items, OrderInterface $order, OrderItemInterface $orderItem)
{
$order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
$order->getItems()->willReturn($items);
$order->isEmpty()->willReturn(false);
$items->count()->willReturn(1);
$items->getIterator()->willReturn($iterator);
$iterator->rewind()->shouldBeCalled();
$iterator->valid()->willReturn(true, false)->shouldBeCalled();
$iterator->current()->willReturn($orderItem);
$iterator->next()->shouldBeCalled();
$orderItem->removeAdjustmentsRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
$order->getShippingAddress()->willReturn($address);
$zoneMatcher->match($address)->willReturn(null);
$defaultTaxZoneProvider->getZone()->willReturn(null);
$orderItemsTaxesApplicator->apply(Argument::any())->shouldNotBeCalled();
$this->apply($order);
}
示例5: addressingAction
public function addressingAction(Request $request, OrderInterface $order)
{
if ($order->isEmpty()) {
return new Response('Order cannot be empty!', 400);
}
if ($request->isMethod('GET')) {
return new Response('Method not allowed!', 405);
}
$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_INITIALIZE, $order);
$form = $this->createCheckoutAddressingForm($order);
if ($form->submit($request)->isValid()) {
$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_PRE_COMPLETE, $order);
$stateMachine = $this->get('sm.factory')->get($order, OrderCheckoutTransitions::GRAPH);
$stateMachine->apply(OrderCheckoutTransitions::SYLIUS_ADDRESSING);
$this->getManager()->persist($order);
$this->getManager()->flush();
$this->dispatchCheckoutEvent(SyliusCheckoutEvents::ADDRESSING_COMPLETE, $order);
return $this->handleView($this->view($order));
}
return $this->handleView($this->view($form, 400));
}
示例6:
function it_does_not_process_taxes_if_there_is_no_tax_zone(ZoneProviderInterface $defaultTaxZoneProvider, ZoneMatcherInterface $zoneMatcher, AddressInterface $address, \Iterator $itemsIterator, Collection $items, OrderInterface $order, OrderItemInterface $orderItem, PrioritizedServiceRegistryInterface $strategyRegistry)
{
$order->removeAdjustments(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
$order->getItems()->willReturn($items);
$order->isEmpty()->willReturn(false);
$items->count()->willReturn(1);
$items->getIterator()->willReturn($itemsIterator);
$itemsIterator->rewind()->shouldBeCalled();
$itemsIterator->valid()->willReturn(true, false)->shouldBeCalled();
$itemsIterator->current()->willReturn($orderItem);
$itemsIterator->next()->shouldBeCalled();
$orderItem->removeAdjustmentsRecursively(AdjustmentInterface::TAX_ADJUSTMENT)->shouldBeCalled();
$order->getShippingAddress()->willReturn($address);
$zoneMatcher->match($address)->willReturn(null);
$defaultTaxZoneProvider->getZone($order)->willReturn(null);
$strategyRegistry->all()->shouldNotBeCalled();
$this->process($order);
}