2026-10-03 16:27:22 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use App\Core\Database;
|
|
|
|
|
|
|
|
|
|
class Round {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Holt eine Runde anhand der ID
|
|
|
|
|
*/
|
|
|
|
|
public static function getById($id) {
|
|
|
|
|
$db = Database::getConnection();
|
|
|
|
|
$stmt = $db->prepare("SELECT * FROM rounds WHERE id = ?");
|
|
|
|
|
$stmt->execute([$id]);
|
|
|
|
|
return $stmt->fetch();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Holt alle Runden einer Season
|
|
|
|
|
*/
|
|
|
|
|
public static function getBySeason($seasonId) {
|
|
|
|
|
$db = Database::getConnection();
|
|
|
|
|
$stmt = $db->prepare("SELECT * FROM rounds WHERE season_id = ? ORDER BY id ASC");
|
|
|
|
|
$stmt->execute([$seasonId]);
|
|
|
|
|
return $stmt->fetchAll();
|
|
|
|
|
}
|
2026-10-04 18:02:53 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Aktualisiert den Namen einer Runde.
|
|
|
|
|
*
|
|
|
|
|
* @param int $id
|
|
|
|
|
* @param string $name
|
|
|
|
|
* @return bool
|
|
|
|
|
*/
|
|
|
|
|
public static function updateName($id, $name) {
|
|
|
|
|
$db = Database::getConnection();
|
|
|
|
|
$stmt = $db->prepare("UPDATE rounds SET name = ?, updated_at = NOW() WHERE id = ?");
|
|
|
|
|
return $stmt->execute([$name, $id]);
|
|
|
|
|
}
|
2026-10-03 16:27:22 +02:00
|
|
|
}
|