public function getAllProducts() { $product = new \Model\Product(); return $product->fetchAll(); }
public function deleteProduct(\Request $req, \Response $res) { $product = new \Model\Product($req->param("id")); $product->deleteFromDb(); \Response::RedirectTo("Controller\\Product::listProduct", array(), "Product '{$product->username}' deleted"); }
/** * Demo function, this is how you get all Products (or at least the first 50) * @return array */ public function getProducts() { if (!$this->hasAccessToken()) { throw new \InvalidArgumentException('access token missing'); } return Model\Product::find('all', $this->getConnection()); }