Skip to content

Commit

Permalink
persist order status fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jakublech committed Feb 1, 2022
1 parent 3c14648 commit 2222783
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
1 change: 0 additions & 1 deletion src/Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<service id="Spinbits\SyliusBaselinkerPlugin\Service\OrderCreateService" autowire="true" autoconfigure="true">
<argument key="$orderItemFactory" type="service" id="sylius.custom_factory.order_item"/>
<argument key="$addressFactory" type="service" id="sylius.custom_factory.address"/>
<argument key="$cartManager" type="service" id="sylius.manager.order"/>
<argument key="$stateMachineFactory" type="service" id="sm.factory"/>
</service>
<service id="Spinbits\SyliusBaselinkerPlugin\Service\OrderUpdateService" autowire="true" autoconfigure="true">
Expand Down
9 changes: 1 addition & 8 deletions src/Service/OrderCreateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class OrderCreateService
private StateMachineFactory $stateMachineFactory;
private PaymentFactoryInterface $paymentFactory;
private PaymentMethodRepositoryInterface $paymentMethodRepository;
private ObjectManager $cartManager;

public function __construct(
Factory $orderFactory,
Expand All @@ -75,8 +74,7 @@ public function __construct(
ChannelContextInterface $channelContext,
OrderItemQuantityModifierInterface $orderItemQuantityModifier,
OrderProcessorInterface $orderProcessor,
StateMachineFactory $stateMachineFactory,
ObjectManager $cartManager
StateMachineFactory $stateMachineFactory
) {
$this->orderFactory = $orderFactory;
$this->orderItemFactory = $orderItemFactory;
Expand All @@ -93,7 +91,6 @@ public function __construct(
$this->stateMachineFactory = $stateMachineFactory;
$this->paymentFactory = $paymentFactory;
$this->paymentMethodRepository = $paymentMethodRepository;
$this->cartManager = $cartManager;
}

public function createOrder(OrderAddModel $orderAddModel, ?string $paymentMethodCode = null): OrderInterface
Expand Down Expand Up @@ -206,11 +203,7 @@ private function checkout(OrderInterface $order): void
{
$stateMachine = $this->stateMachineFactory->get($order, OrderCheckoutTransitions::GRAPH);
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_ADDRESS);
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_SKIP_SHIPPING);
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_SELECT_PAYMENT);
$stateMachine->apply(OrderCheckoutTransitions::TRANSITION_COMPLETE);

$this->cartManager->flush();
}

private function markPayment(OrderInterface $order, bool $paid): void
Expand Down

0 comments on commit 2222783

Please sign in to comment.