Example #1
0
    // 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;
    $response["SoccerMatches"] = array();
    // looping through result and preparing soccer matches array
    while ($soccerMatch = $result->fetch_assoc()) {
        $soccerMatch["IsPracticeMatch"] = (bool) $soccerMatch["IsPracticeMatch"];
        array_push($response["SoccerMatches"], $soccerMatch);
    }
    echoRespnse(200, $response);
});
$app->get('/soccer-matches/:id/', function ($soccerMatchID) {
    global $user_id;
    $response = array();
    $response["Error"] = false;
    $response["SoccerMatch"] = array();
    $db = new DbHandler();