Added unregistered error

This commit is contained in:
Kevin Frantz 2018-07-15 16:55:03 +02:00
parent 306c38c2b2
commit 55e18fa608
1 changed files with 3 additions and 0 deletions

View File

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