Solved transaction bug

This commit is contained in:
Kevin Frantz committed 2018-07-15 16:17:11 +02:00
1 parent 541c472f15
commit 244b18a42f
2 files changed
+6 -8

No files matched your search

+5 -7
View File
@@ -43,7 +43,10 @@ final class Order extends AbstractDefaultController implements OrderInterface
}
private function store(): void
{}
{
$this->core->getBasket()->setCustomer($this->core->getUser());
$this->core->setBasket(new OrderEntity());
}
public function basket(): void
{
@@ -62,12 +65,7 @@ final class Order extends AbstractDefaultController implements OrderInterface
$this->addProduct();
}
if ($this->post['store']){
$this->core->getBasket()->setCustomer($this->core->getUser());
if($this->orderRepository->saveOrder($this->core->getBasket())){
$this->core->setBasket(new OrderEntity());
}else{
throw new \Exception('Order could not be saved!');
}
$this->store();
}
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ final class Order extends AbstractRepository implements OrderInterface
$this->database->beginTransaction();
$this->saveOrderEntity($order);
$this->saveConnection($order);
return $this->database->rollBack();
return $this->database->commit();
}
/**