コード例 #1
0
ファイル: DisciplineDAO.php プロジェクト: PPEagvn/ppe_gestion
 /**
  * @param Discipline $_discipline
  *
  * Ajout et modification d'une matière
  */
 public function saveDiscipline(Discipline $_discipline)
 {
     $disciplineData = array('name_discipline' => $_discipline->getNameDiscipline(), 'description' => $_discipline->getDescription(), 'dt_create' => $_discipline->getDtCreate(), 'dt_update' => $_discipline->getDtUpdate());
     if ($_discipline->getIdDiscipline()) {
         $this->getDb()->update('discipline', $disciplineData, array('id_discipline' => $_discipline->getIdDiscipline()));
     } else {
         $this->getDb()->insert('discipline', $disciplineData);
         $id = $this->getDb()->lastInsertId();
         $_discipline->setIdDiscipline($id);
     }
 }
コード例 #2
0
 public function deleteDisciplineAction(Request $request, Application $app)
 {
     $id_discipline = $request->request->get('id_discipline');
     $newDiscipline = new Discipline();
     $newDiscipline->setIdDiscipline($id_discipline);
     $app['dao.discipline']->deleteDiscipline($newDiscipline->getIdDiscipline());
     $app['session']->getFlashBag()->add('danger', 'Matière supprimée !');
     return $app->redirect($app['url_generator']->generate('disciplineslist'));
 }