/** * Save Salery Grade * @param sfWebRequest $request * @return unknown_type */ public function executeSaveSaleryGrade(sfWebRequest $request) { if ($request->isMethod('post')) { $jobService = new JobService(); $saleryGrade = new SalaryGrade(); $saleryGrade->setSalGrdName($request->getParameter('txtName')); $jobService->saveSaleryGrade($saleryGrade); $this->setMessage('SUCCESS', array(TopLevelMessages::SAVE_SUCCESS)); $this->redirect('admin/listSaleryGrade'); } }
/** * Saves SalaryGrade * @param String $id * @returns SalaryGrade. this is preserved as in the original but better to return boolean * @throws DaoException */ public function saveSalaryGrade(SalaryGrade $salaryGrade) { try { if ($salaryGrade->getSalGrdCode() == '') { $idGenService = new IDGeneratorService(); $idGenService->setEntity($salaryGrade); $salaryGrade->setSalGrdCode($idGenService->getNextID()); } $salaryGrade->save(); return $salaryGrade; } catch (Doctrine_Connection_Mysql_Exception $e) { throw new DataDuplicationException($e->getMessage()); } catch (Exception $e) { throw new DaoException($e->getMessage()); } }