public static function getListWithCandidates($electionId) { $multiple = self::getList($electionId); if (empty($multiple)) { return array(); } foreach ($multiple as &$value) { $candidates = Candidate::getCandidateList($value['id']); $value['candidates'] = $candidates; } return $multiple; }
protected function getJsonView($data, \Request $request) { if (!$request->isVar('command')) { throw new \Exception('Unknown Candidate command'); } $json = array('success' => true); $command = $request->getVar('command'); switch ($command) { case 'ticketList': $json = Factory::getTicketList(Factory::pullGetInteger('ticketId')); break; case 'candidateList': $json = Factory::getCandidateList(Factory::pullGetInteger('multipleId')); break; } $view = new \View\JsonView($json); return $view; }