|
|
@ -147,11 +147,10 @@ class TeamGateway {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public function listAll(int $start, int $n): array {
|
|
|
|
public function listAll(int $start, int $n): array {
|
|
|
|
$rows = $this->con->fetch(
|
|
|
|
$rows = $this->con->fetch(
|
|
|
|
"SELECT * FROM Team WHERE id BETWEEN :start AND :n LIMIT :limit",
|
|
|
|
"SELECT * FROM Team LIMIT :start, :n",
|
|
|
|
[
|
|
|
|
[
|
|
|
|
":start" => [$start, PDO::PARAM_INT],
|
|
|
|
":start" => [$start, PDO::PARAM_INT],
|
|
|
|
":n" => [$n, PDO::PARAM_INT],
|
|
|
|
":n" => [$n, PDO::PARAM_INT],
|
|
|
|
":limit" => [$n - $start + 1, PDO::PARAM_INT], //nombre de lignes à récupérer
|
|
|
|
|
|
|
|
]
|
|
|
|
]
|
|
|
|
);
|
|
|
|
);
|
|
|
|
return array_map(fn($row) => new TeamInfo($row['id'], $row['name'], $row['picture'], $row['main_color'], $row['second_color']), $rows);
|
|
|
|
return array_map(fn($row) => new TeamInfo($row['id'], $row['name'], $row['picture'], $row['main_color'], $row['second_color']), $rows);
|
|
|
@ -159,12 +158,23 @@ class TeamGateway {
|
|
|
|
|
|
|
|
|
|
|
|
public function countTeam(): int {
|
|
|
|
public function countTeam(): int {
|
|
|
|
$result = $this->con->fetch(
|
|
|
|
$result = $this->con->fetch(
|
|
|
|
"SELECT count(*) FROM Team", []);
|
|
|
|
"SELECT count(*) as count FROM Team", []);
|
|
|
|
if (empty($result) || !isset($result[0]['count'])) {
|
|
|
|
if (empty($result) || !isset($result[0]['count'])) {
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $result[0]['count'];
|
|
|
|
return $result[0]['count'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function deleteTeamSelected(array $selectedTeams): void {
|
|
|
|
|
|
|
|
foreach ($selectedTeams as $team) {
|
|
|
|
|
|
|
|
$this->con->exec(
|
|
|
|
|
|
|
|
"DELETE FROM TEAM WHERE id=:team",
|
|
|
|
|
|
|
|
[
|
|
|
|
|
|
|
|
"team" => [$team, PDO::PARAM_INT],
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|