/** * @throws Exception if the key is unkown * @return \model\Product */ public function getSelectedProduct() { assert($this->navigation->customerWantsToSeeProduct()); $unique = $this->navigation->getProductID(); $product = $this->catalog->getProductFromUnique($unique); if ($product != null) { return $product; } throw new \Exception("unknown key"); }
public function doStore() { if ($this->navigationView->customerWantsToSeeProduct()) { //setup controller $selectedProduct = $this->productCatalogView->getSelectedProduct(); $productLikes = new \model\ProductLikes($selectedProduct); $popularityView = new \view\PopularityView($this->navigationView, $selectedProduct, $productLikes); $likeController = new PopularityController($popularityView, $productLikes); //execute child controller $likeController->doLike(); //initiate view $this->productView = new \view\ProductView($selectedProduct, $this->navigationView, $popularityView); } }