예제 #1
0
 public function addAction(Request $request, Application $app)
 {
     $newClass = new ClassName();
     if (null !== $request->request->get('id_class')) {
         $newClass->setIdClassName($request->request->get('id_class'));
         $newClass->setDtCreate($newClass->getDtCreate());
     }
     $newClass->setClassName($request->request->get('class_name'));
     $newClass->setClassType($request->request->get('class_type'));
     $newClass->setClassOption($request->request->get('option'));
     $newClass->setClassYear($request->request->get('year'));
     $newClass->setDescription($request->request->get('description'));
     $newClass->setDtCreate('Y-m-d H:i:s');
     $newClass->setDtUpdate(date('Y-m-d H:i:s'));
     $app['dao.className']->saveClassName($newClass);
     if (null !== $request->request->get('id_class')) {
         $app['session']->getFlashBag()->add('success', 'La classe a été modifiée avec succès !');
         return $app->redirect($app['url_generator']->generate('classeslist'));
     } else {
         $app['session']->getFlashBag()->add('success', 'La classe a été ajoutée avec succès !');
         return $app->redirect($app['url_generator']->generate('classeslist'));
     }
 }
예제 #2
0
 /**
  * @param $row
  * @return ClassName
  *
  * construction de l'objet concernant les classes
  */
 protected function buildDomainObject($row)
 {
     $class = new ClassName();
     $class->setIdClassName($row['id_class']);
     $class->setClassName($row['class_name']);
     $class->setClassType($row['class_type']);
     $class->setClassOption($row['class_option']);
     $class->setClassYear($row['class_year']);
     $class->setDescription($row['description']);
     $class->setDtCreate($row['dt_create']);
     $class->setDtUpdate($row['dt_update']);
     return $class;
 }