/** * Add contest to a group scoreboard * * @param Request $r */ public static function apiRemoveContest(Request $r) { self::validateGroupScoreboardAndContest($r); try { $groupScoreboardContestKey = new GroupsScoreboardsContests(array("group_scoreboard_id" => $r["scoreboard"]->group_scoreboard_id, "contest_id" => $r["contest"]->contest_id)); $gscs = GroupsScoreboardsContestsDAO::search($groupScoreboardContestKey); if (is_null($gscs) || count($gscs) === 0) { throw new InvalidParameterException("parameterNotFound", "Contest"); } GroupsScoreboardsContestsDAO::delete($groupScoreboardContestKey); self::$log->info("Contest " . $r["contest_alias"] . "removed from group " . $r["group_alias"]); } catch (ApiException $ex) { throw $ex; } catch (Exception $ex) { throw new InvalidDatabaseOperationException($ex); } return array("status" => "ok"); }
/** * Add contest to a group scoreboard * * @param Request $r */ public static function apiRemoveContest(Request $r) { self::validateGroupScoreboardAndContest($r); try { $groupScoreboardContestKey = new GroupsScoreboardsContests(array('group_scoreboard_id' => $r['scoreboard']->group_scoreboard_id, 'contest_id' => $r['contest']->contest_id)); $gscs = GroupsScoreboardsContestsDAO::search($groupScoreboardContestKey); if (is_null($gscs) || count($gscs) === 0) { throw new InvalidParameterException('parameterNotFound', 'Contest'); } GroupsScoreboardsContestsDAO::delete($groupScoreboardContestKey); self::$log->info('Contest ' . $r['contest_alias'] . 'removed from group ' . $r['group_alias']); } catch (ApiException $ex) { throw $ex; } catch (Exception $ex) { throw new InvalidDatabaseOperationException($ex); } return array('status' => 'ok'); }