30 lines
657 B
PHP
30 lines
657 B
PHP
|
<?php $app = require '../../../app/inc.php';
|
||
|
/**
|
||
|
* Remove times from timetable and update teamtable with new times
|
||
|
*/
|
||
|
|
||
|
use App\Teamtable\Team;
|
||
|
use App\Teamtable\TeamMapper;
|
||
|
use App\Timetable\Time;
|
||
|
use App\Timetable\TimeMapper;
|
||
|
|
||
|
$teamMapper = new TeamMapper($app->database->conn);
|
||
|
$timeMapper = new TimeMapper($app->database->conn);
|
||
|
|
||
|
// reset counters for all teams
|
||
|
$teams = $teamMapper->getAll();
|
||
|
|
||
|
foreach ($teams as $key => $team)
|
||
|
{
|
||
|
$team->setRounds(0);
|
||
|
$team->bestTime = NULL;
|
||
|
$teamMapper->update($team);
|
||
|
}
|
||
|
|
||
|
// delete all time records
|
||
|
$times = $timeMapper->getAll();
|
||
|
|
||
|
foreach ($times as $key => $time)
|
||
|
{
|
||
|
$timeMapper->delete($time->id);
|
||
|
}
|