Пример #1
0
 public static function getJobApplication(MongoId $jobId)
 {
     // Check job exists.
     if (!self::jobExists($jobId)) {
         return [];
     }
     return JobModel::getApplicationQuestionIds($jobId);
 }
Пример #2
0
 /**
  * Creates a student application to be inserted into the 'applications'
  * collection.
  * Need to make sure student has not already saved an application for the
  * job.
  */
 private static function create(MongoId $jobId, MongoId $studentId, array $questions, $submitted)
 {
     // Retrieve application list from $jobId.
     $applicationQuestions = JobModel::getApplicationQuestionIds($jobId);
     // Build question-answer pairs.
     $savedQuestions = self::pruneQuestionsByIdSet($questions, $applicationQuestions);
     // Save the application.
     $application = new ApplicationStudent(['jobid' => $jobId, 'studentid' => $studentId, 'questions' => $savedQuestions, 'submitted' => $submitted]);
     $id = ApplicationModel::insert($application->getData());
     $application->setId($id);
     // Return created application.
     return $application;
 }