/** * Deletes a product * * @param string $id */ public function deleteAction($id) { $products = Products::findFirstById($id); if (!$products) { $this->flash->error("Product was not found"); return $this->forward("products/index"); } if (!$products->delete()) { foreach ($products->getMessages() as $message) { $this->flash->error($message); } return $this->forward("products/search"); } $this->flash->success("Product was deleted"); return $this->forward("products/index"); }