Esempio n. 1
0
 /**
  * Hydrate applicant records
  * 
  * @param type $stmt
  * @param type $resultSetMapping
  * @param array $hints
  * @return array
  */
 public function hydrateAll($stmt, $resultSetMapping, array $hints = array())
 {
     $result = parent::hydrateAll($stmt, $resultSetMapping, $hints);
     foreach ($result as $key => $applicant) {
         $name = array($applicant['firstName'], $applicant['middleName'], $applicant['lastName'], $applicant['suffix']);
         //remove blanks
         $name = array_filter($name, 'strlen');
         $applicant['fullName'] = implode(' ', $name);
         $answers = $applicant['answers'];
         $applicant['answers'] = array();
         foreach ($answers as $answer) {
             $pageId = $answer['page_id'];
             if (!isset($applicant['answers'][$pageId])) {
                 $applicant['answers'][$pageId] = array();
             }
             $applicant['answers'][$pageId][] = $this->hydrateAnswer($answer);
         }
         if ($applicant['decision']) {
             $decisions = array('nominateAdmit', 'nominateDeny', 'finalAdmit', 'finalDeny', 'acceptOffer', 'declineOffer');
             $final = '';
             foreach ($decisions as $decision) {
                 if ($applicant['decision'][$decision]) {
                     $final = $decision;
                 }
             }
             $applicant['decision']['status'] = $final;
         }
         foreach ($applicant['attachments'] as $attachmentKey => $attachment) {
             if (array_key_exists('answer_id', $attachment) and !empty($attachment['answer_id'])) {
                 unset($applicant['attachments'][$attachmentKey]);
             }
         }
         $result[$key] = $applicant;
     }
     return $result;
 }
Esempio n. 2
0
 /**
  * @param object $stmt
  * @param object $resultSetMapping
  * @param array $hints
  * @return array
  */
 public function hydrateAll($stmt, $resultSetMapping, array $hints = [])
 {
     return array_map('Nette\\Utils\\ArrayHash::from', parent::hydrateAll($stmt, $resultSetMapping, $hints));
 }