/** * Deletes a student * * @param string $id */ public function deleteAction($id) { $student = Students::findFirstByid($id); if (!$student) { $this->flash->error("student was not found"); return $this->dispatcher->forward(array("controller" => "students", "action" => "index")); } if (!$student->delete()) { foreach ($student->getMessages() as $message) { $this->flash->error($message); } return $this->dispatcher->forward(array("controller" => "students", "action" => "search")); } $this->flash->success("student was deleted successfully"); return $this->dispatcher->forward(array("controller" => "students", "action" => "index")); }