mirror of
https://github.com/kevinveenbirkenbach/coding-challenge-online-shop.git
synced 2024-11-26 03:51:06 +01:00
Added unregistered error
This commit is contained in:
parent
306c38c2b2
commit
55e18fa608
@ -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());
|
||||||
|
Loading…
Reference in New Issue
Block a user