Example #1
0
        array_push($response["Teams"], $team);
    }
    echoRespnse(200, $response);
});
/**
 * Gets a particular team
 * method GET
 * url /teams
 */
$app->get('/teams/:teamID', function ($teamID) use($app) {
    $req = $app->request();
    $seasonID = $req->get('seasonID');
    $response = array();
    $db = new DbHandler();
    // fetching all teams
    $teamResult = $db->getTeam($teamID);
    $team = $teamResult->fetch_assoc();
    $playersResult = $db->getSeasonTeamPlayers($teamID, $seasonID);
    $players = array();
    while ($player = $playersResult->fetch_assoc()) {
        array_push($players, $player);
    }
    $team["Players"] = $players;
    $response["Error"] = false;
    $response["Team"] = $team;
    echoRespnse(200, $response);
});
/**
 * Gets the competitions of a team for a particular season
 * method GET
 */