/**
  *
  */
 public function performAction()
 {
     $note = $this->getValue('notes');
     if ($this->id > 0) {
         $history = $this->getCandidateService()->getCandidateHistoryById($this->id);
         $history->setNote($note);
         $this->getCandidateService()->saveCandidateHistory($history);
         $this->historyId = $history->getId();
         $resultArray['messageType'] = 'success';
         $resultArray['message'] = __(TopLevelMessages::SAVE_SUCCESS);
         return $resultArray;
     }
     $result = $this->getCandidateService()->updateCandidateVacancy($this->selectedCandidateVacancy, $this->selectedAction, sfContext::getInstance()->getUser()->getAttribute('user'));
     $interviews = $this->getInterviewService()->getInterviewsByCandidateVacancyId($this->candidateVacancyId);
     $interview = $interviews[count($interviews) - 1];
     $candidateHistory = new CandidateHistory();
     $candidateHistory->setCandidateId($this->candidateId);
     $candidateHistory->setVacancyId($this->vacancyId);
     $candidateHistory->setAction($this->selectedAction);
     $candidateHistory->setCandidateVacancyName($this->selectedCandidateVacancy->getVacancyName());
     if (!empty($interview)) {
         if ($this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_SHEDULE_INTERVIEW || $this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_SHEDULE_2ND_INTERVIEW || $this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_MARK_INTERVIEW_PASSED || $this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_MARK_INTERVIEW_FAILED) {
             $candidateHistory->setInterviewId($interview->getId());
         }
     }
     $empNumber = sfContext::getInstance()->getUser()->getEmployeeNumber();
     if ($empNumber == 0) {
         $empNumber = null;
     }
     $candidateHistory->setPerformedBy($empNumber);
     $date = date('Y-m-d');
     $candidateHistory->setPerformedDate($date . " " . date('H:i:s'));
     $candidateHistory->setNote($note);
     $result = $this->getCandidateService()->saveCandidateHistory($candidateHistory);
     $this->historyId = $candidateHistory->getId();
     if ($this->selectedAction == WorkflowStateMachine::RECRUITMENT_APPLICATION_ACTION_HIRE) {
         $employee = new Employee();
         $employee->firstName = $this->selectedCandidateVacancy->getJobCandidate()->getFirstName();
         $employee->middleName = $this->selectedCandidateVacancy->getJobCandidate()->getMiddleName();
         $employee->lastName = $this->selectedCandidateVacancy->getJobCandidate()->getLastName();
         $employee->emp_oth_email = $this->selectedCandidateVacancy->getJobCandidate()->getEmail();
         $employee->job_title_code = $this->selectedCandidateVacancy->getJobVacancy()->getJobTitleCode();
         $employee->jobTitle = $this->selectedCandidateVacancy->getJobVacancy()->getJobTitle();
         $this->getCandidateService()->addEmployee($employee);
     }
 }
 /**
  *
  * @param CandidateHistory $candidateHistory
  * @return <type>
  */
 public function saveCandidateHistory(CandidateHistory $candidateHistory)
 {
     try {
         if ($candidateHistory->getId() == '') {
             $idGenService = new IDGeneratorService();
             $idGenService->setEntity($candidateHistory);
             $candidateHistory->setId($idGenService->getNextID());
         }
         $candidateHistory->save();
         return true;
     } catch (Exception $e) {
         throw new DaoException($e->getMessage());
     }
 }