mirror of
https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
synced 2025-09-08 19:07:12 +02:00
Added unregistered error
This commit is contained in:
@@ -44,6 +44,9 @@ final class Order extends AbstractDefaultController implements OrderInterface
|
||||
|
||||
private function store(): void
|
||||
{
|
||||
if(!$this->core->getUser()){
|
||||
throw new \Exception('Just registered users can order!');
|
||||
}
|
||||
$this->core->getBasket()->setCustomer($this->core->getUser());
|
||||
if ($this->orderRepository->saveOrder($this->core->getBasket())) {
|
||||
$this->core->setBasket(new OrderEntity());
|
||||
|
Reference in New Issue
Block a user