/** * @param Request $request * @param Response $response * @return string */ public function index($request, $response) { $exception = $request->getParams()["exception"]; $response->setParams(array("errorMessage" => $exception)); return "error"; }
/** * @param Request $request * @param Response $response */ public function delete($request, $response) { try { Student::setRegistry($this->registry); $params = $request->getParams(); $student = Student::find($params["id"]); $student->delete(); } catch (ModelException $e) { $response->setParams(array("exception" => $e->getMessage())); $response->sendRedirect("error"); } $response->sendRedirect("students"); }