In between commit implementing basket

This commit is contained in:
Kevin Frantz
2018-07-15 13:09:06 +02:00
parent 9f059d1202
commit 7470686c56
7 changed files with 85 additions and 32 deletions

View File

@@ -2,6 +2,10 @@
namespace controller\order;
use controller\AbstractDefaultController;
use core\CoreInterface;
use repository\order\OrderInterface as OrderRepositoryInterface;
use repository\product\ProductInterface as ProductRepositoryInterface;
use repository\product\Product as ProductRepository;
/**
*
@@ -10,15 +14,48 @@ use controller\AbstractDefaultController;
*/
final class Order extends AbstractDefaultController implements OrderInterface
{
public function addProduct(): void
{}
public function store(): void
/**
*
* @var OrderRepositoryInterface
*/
protected $orderRepository;
/**
*
* @var ProductRepositoryInterface
*/
protected $productRepository;
public function __construct(CoreInterface $core)
{
parent::__construct($core);
$this->productRepository = new ProductRepository($this->core);
}
private function addProduct(): void
{
$this->core->getBasket()->addProduct($this->productRepository->getById($this->post['add']));
}
private function store(): void
{}
public function basket(): void
{
$this->render('order/basket.html.twig',['basket'=>$this->core->getBasket()]);
if ($this->post) {
$this->postRoutine();
}
$this->render('order/basket.html.twig', [
'basket' => $this->core->getBasket()
]);
}
private function postRoutine(): void
{
if ($this->post['add']) {
$this->addProduct();
}
}
public function selectPaymentMethod(): void