public function editExamenAction(Request $request, Application $app) { $examens = $app['dao.examen']->findAll(); $name = $request->request->get('name'); $id_examen = $request->request->get('id_examen'); $coeff_examen = $request->request->get('coeff_examen'); $notation = $request->request->get('notation'); $date = $request->request->get('date'); $description = $request->request->get('description'); $semestre = $request->request->get('semestre'); $class = $app['dao.className']->findClassname($request->request->get('classname')); $discipline = $app['dao.discipline']->findDiscipline($request->request->get('discipline')); $newExamen = new Examen(); $newExamen->setIdExamen($id_examen); $newExamen->setExamenName($name); $newExamen->setCoeffExamen($coeff_examen); $newExamen->setNotation($notation); $newExamen->setSemestre($semestre); $newExamen->setDateExamen($date); $newExamen->setDescriptionExamen($description); $newExamen->setClass($class); $newExamen->setDiscipline($discipline); $newExamen->setDtUpdate(date('Y-m-d H:i:s')); $app['dao.examen']->saveExamen($newExamen); $app['session']->getFlashBag()->add('success', 'Examen Modifié avec succès !'); return $this::indexAction($request, $app); }
protected function buildDomainObject($row) { $exam = new Examen(); $exam->setIdExamen($row['id_examen']); $exam->setExamenName($row['examen_name']); $exam->setCoeffExamen($row['coeff_examen']); $exam->setNotation($row['notation']); $exam->setDateExamen($row['date']); $exam->setDescriptionExamen($row['description']); $exam->setSemestre($row['semestre']); $exam->setDtCreate($row['dt_create']); $exam->setDtUpdate($row['dt_update']); if (array_key_exists('id_class', $row)) { $classID = $row['id_class']; $class = $this->classDAO->findClassname($classID); $exam->setClass($class); } if (array_key_exists('id_discipline', $row)) { $disciplineID = $row['id_discipline']; $discipline = $this->disciplineDAO->findDiscipline($disciplineID); $exam->setDiscipline($discipline); } return $exam; }