In between commit implementing order repository

This commit is contained in:
Kevin Frantz
2018-07-15 15:40:00 +02:00
parent 3fdcd47e9c
commit aa18f2b18e
3 changed files with 45 additions and 6 deletions

View File

@@ -7,6 +7,8 @@ use repository\order\OrderInterface as OrderRepositoryInterface;
use repository\product\ProductInterface as ProductRepositoryInterface;
use repository\product\Product as ProductRepository;
use entity\payment\AbstractPayment;
use repository\order\Order as OrderRepository;
use entity\order\Order as OrderEntity;
/**
*
@@ -32,6 +34,7 @@ final class Order extends AbstractDefaultController implements OrderInterface
{
parent::__construct($core);
$this->productRepository = new ProductRepository($this->core);
$this->orderRepository = new OrderRepository($this->core);
}
private function addProduct(): void
@@ -58,6 +61,12 @@ final class Order extends AbstractDefaultController implements OrderInterface
if ($this->post['add']) {
$this->addProduct();
}
if ($this->post['store']){
$this->core->getBasket()->setCustomer($this->core->getUser());
if($this->orderRepository->saveOrder($this->core->getBasket())){
$this->core->setBasket(new OrderEntity());
}
}
}
}