Added unregistered error

This commit is contained in:
Kevin Frantz 2018-07-15 16:55:03 +02:00
parent 306c38c2b2
commit 55e18fa608

View File

@ -44,6 +44,9 @@ final class Order extends AbstractDefaultController implements OrderInterface
private function store(): void private function store(): void
{ {
if(!$this->core->getUser()){
throw new \Exception('Just registered users can order!');
}
$this->core->getBasket()->setCustomer($this->core->getUser()); $this->core->getBasket()->setCustomer($this->core->getUser());
if ($this->orderRepository->saveOrder($this->core->getBasket())) { if ($this->orderRepository->saveOrder($this->core->getBasket())) {
$this->core->setBasket(new OrderEntity()); $this->core->setBasket(new OrderEntity());