public function deleteAction($id) { $id = $this->filter->sanitize($id, array("int")); $producttypes = ProductTypes::findFirst('id="' . $id . '"'); if (!$producttypes) { Flash::error("product types was not found", "alert alert-error"); return $this->_forward("producttypes/index"); } if (!$producttypes->delete()) { foreach ($producttypes->getMessages() as $message) { Flash::error((string) $message, "alert alert-error"); } return $this->_forward("producttypes/search"); } else { Flash::success("product types was deleted", "alert alert-success"); return $this->_forward("producttypes/index"); } }