/** * * @param Registration $registration * @param type $statusType * @param DateTime $timestamp * @throws InvalidArgumentException */ protected function updateRegistrationStatus(Registration $registration, $statusType, DateTime $timestamp = null) { if (!RecruitmentStatus::statusTypeExists($statusType)) { throw new InvalidArgumentException('Situação inválida'); } if ($timestamp === null) { $timestamp = new DateTime('now'); } $em = $this->getEntityManager(); $recStatus = $em->getRepository('Recruitment\\Entity\\RecruitmentStatus')->findOneBy(array('statusType' => $statusType)); if ($recStatus !== null) { /** * retira o status anterior isCurrent = false */ if ($registration->getRegistrationId() !== null) { $registration->getCurrentRegistrationStatus()->setIsCurrent(false); } // cria um status $regStatus = new RegistrationStatus(); // associa o tipo e a data $regStatus->setRecruitmentStatus($recStatus)->setTimestamp($timestamp); // associa o status à inscrição $registration->addRegistrationStatus($regStatus); } }
/** * Lista os candidatos de processos seletivos de alunos cuja a entrevista * pode ser realizada. Candidatos em um dos status: * - RecruitmentStatus::STATUSTYPE_CALLEDFOR_PREINTERVIEW * - RecruitmentStatus::STATUSTYPE_PREINTERVIEW_COMPLETE * - RecruitmentStatus::STATUSTYPE_INTERVIEWED * * @return ViewModel */ public function studentListAction() { try { $em = $this->getEntityManager(); $recruitment = $em->getRepository('Recruitment\\Entity\\Recruitment')->findLastClosed(Recruitment::STUDENT_RECRUITMENT_TYPE); $candidates = []; if (isset($recruitment['recruitmentId'])) { $candidates = $em->getRepository('Recruitment\\Entity\\Registration')->findByStatusSimplified($recruitment['recruitmentId'], [RecruitmentStatus::STATUSTYPE_CALLEDFOR_PREINTERVIEW, RecruitmentStatus::STATUSTYPE_PREINTERVIEW_COMPLETE, RecruitmentStatus::STATUSTYPE_INTERVIEWED]); } foreach ($candidates as $i => $candidate) { $candidateRegistration = $em->find('Recruitment\\Entity\\Registration', $candidate['registrationId']); $candidateInterview = $candidateRegistration->getStudentInterview(); if ($candidateInterview !== null) { $candidates[$i]['grades'] = ['socioeconomic' => $candidateInterview->getInterviewSocioeconomicGrade(), 'vulnerability' => $candidateInterview->getInterviewVulnerabilityGrade(), 'student' => $candidateInterview->getInterviewStudentGrade()]; } else { $candidates[$i]['grades'] = null; } $candidates[$i]['statusType'] = RecruitmentStatus::statusTypeToString($candidates[$i]['statusType']); } return new ViewModel(['recruitment' => $recruitment, 'candidates' => $candidates]); } catch (\Exception $ex) { return new ViewModel(['recruitment' => null, 'candidates' => null]); } }
/** * * @param Recruitment\Entity\RecruitmentStatus $recStatus * @return Recruitment\Entity\RegistrationStatus */ public function setRecruitmentStatus(RecruitmentStatus $recStatus) { $recStatus->addRegStatus($this); $this->recruitmentStatus = $recStatus; return $this; }