From 55e18fa60884468e902297ef8662c1649a0f45ff Mon Sep 17 00:00:00 2001 From: Kevin Frantz Date: Sun, 15 Jul 2018 16:55:03 +0200 Subject: [PATCH] Added unregistered error --- src/controller/order/Order.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/controller/order/Order.php b/src/controller/order/Order.php index f15936d..82ca7fc 100644 --- a/src/controller/order/Order.php +++ b/src/controller/order/Order.php @@ -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());