Beispiel #1
0
    echoRespnse(200, $response);
});
//  ==============================
//  ======== SOCCERMATCH =========
//  ==============================
/**
 * Listing all soccer matches of a particular competition
 * method GET
 * url /matches
 */
$app->get('/competitions/:id/soccer-matches', function ($competition_id) {
    global $user_id;
    $response = array();
    $db = new DbHandler();
    // fetching all soccer matches for the given competition
    $result = $db->getSoccerMatchesByCompetition($user_id, $competition_id);
    $response["Error"] = false;
    $response["SoccerMatches"] = array();
    // looping through result and preparing soccer matches array
    while ($soccerMatch = $result->fetch_assoc()) {
        array_push($response["SoccerMatches"], $soccerMatch);
    }
    echoRespnse(200, $response);
});
$app->get('/teams/:teamID/seasons/:seasonID/soccer-matches', function ($teamID, $seasonID) {
    global $user_id;
    $response = array();
    $db = new DbHandler();
    // fetching all soccer matches for the given season and team
    $result = $db->getSoccerMatchesBySeasonAndTeam($user_id, $seasonID, $teamID);
    $response["Error"] = false;