/** * @param int|null $userID * @param int|null $eventID * @return Application * @throws SQLException */ public function getApplication($userID = null, $eventID = null) { global $sessioninfo; if ($userID === null) { $userID = $sessioninfo->userID; } if ($eventID === null) { $eventID = $sessioninfo->eventID; } $crewIDs = $this->getCrewsIDArray(array($eventID)); // Create initial object $application = new Application(\UserManager::getInstance()->getUserByID($userID), array(), array()); // Fetch all question responses. $application->setResponses($this->getQuestionResponsesByUser($userID)); // Fetch all crew responses $application->setCrewResponses($this->getCrewResponsesByUser($userID, $crewIDs)); // Fetch comments $application->setComments($this->getApplicationComments($userID, $crewIDs)); return $application; }