public function deleteStudentAction(Request $request, Application $app) { $id_student = $request->request->get('id_student'); $newStudent = new Student(); $newStudent->setIdStudent($id_student); $app['dao.student']->deleteStudent($newStudent->getIdStudent()); return $this::deleteStudentIndexAction($request, $app); }
/** * @param Student $student * Fonction de sauvegarde d'un étudiant */ public function saveStudent(Student $student) { $studentInfo = array('student_name' => $student->getName(), 'student_firstname' => $student->getFirstname(), 'student_birthday' => $student->getBirthday(), 'student_email' => $student->getEmail(), 'student_address' => $student->getAddress(), 'student_tel' => $student->getTel(), 'dt_create' => $student->getDtCreate(), 'dt_update' => $student->getDtUpdate(), 'id_class' => $student->getClass()->getIdClassName(), 'id_statut' => $student->getStatut()->getId()); //on modifie if ($student->getIdStudent()) { $this->getDb()->update('student', $studentInfo, array('id_student' => $student->getIdStudent())); } else { $this->getDb()->insert('student', $studentInfo); $id = $this->getDb()->lastInsertId(); $student->setIdStudent($id); } }