Solved transaction bug

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

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();
}
}
}

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();
}
/**