Skip to content

Commit

Permalink
[shopsys] upgraded doctrine/orm to latest version (#2775)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasLudvik authored Sep 12, 2023
1 parent e64d75e commit 4c86a91
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@
"docker": false
}
},
"conflict": {
"doctrine/orm": "2.12.0 || >=2.16.0"
},
"suggest": {
"ext-pgsql": "Required for dumping the Postgres database in shopsys:database:dump command"
},
Expand Down
1 change: 1 addition & 0 deletions src/Model/Order/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public function __construct(
$this->createdAsAdministratorName = $orderData->createdAsAdministratorName;
$this->origin = $orderData->origin;
$this->uuid = $orderData->uuid ?: Uuid::uuid4()->toString();
$this->setTotalPrice(new OrderTotalPrice(Money::zero(), Money::zero(), Money::zero()));
}

/**
Expand Down
15 changes: 9 additions & 6 deletions src/Model/Order/OrderFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,15 @@ public function createOrder(OrderData $orderData, OrderPreview $orderPreview, ?C
$customerUser,
);

$this->fillOrderItems($order, $orderPreview);
$this->em->persist($order);
$this->em->flush();

foreach ($order->getItems() as $orderItem) {
$this->em->persist($orderItem);
}
$this->fillOrderItems($order, $orderPreview);

$order->setTotalPrice(
$this->orderPriceCalculation->getOrderTotalPrice($order),
);

$this->em->persist($order);
$this->em->flush();

return $order;
Expand Down Expand Up @@ -389,6 +387,9 @@ protected function fillOrderProducts(Order $order, OrderPreview $orderPreview, s
$product,
);

$this->em->persist($orderItem);
$this->em->flush();

if ($quantifiedItemDiscount !== null) {
$this->addOrderItemDiscount(
$orderItem,
Expand Down Expand Up @@ -490,7 +491,7 @@ protected function addOrderItemDiscount(
$orderItem->getName(),
);

$this->orderItemFactory->createProduct(
$discount = $this->orderItemFactory->createProduct(
$orderItem->getOrder(),
$name,
$quantifiedItemDiscount->inverse(),
Expand All @@ -500,6 +501,8 @@ protected function addOrderItemDiscount(
null,
null,
);

$this->em->persist($discount);
}

/**
Expand Down

0 comments on commit 4c86a91

Please sign in to comment.