diff --git a/site/app/Admin/Presenters/TrainingsPresenter.php b/site/app/Admin/Presenters/TrainingsPresenter.php index f04d74477..91441ec1c 100644 --- a/site/app/Admin/Presenters/TrainingsPresenter.php +++ b/site/app/Admin/Presenters/TrainingsPresenter.php @@ -71,14 +71,18 @@ public function __construct( } + /** + * @throws BadRequestException + */ public function actionDate(int $param): void { $this->dateId = $param; $this->redirectParam = $this->dateId; - $this->training = $this->trainingDates->get($this->dateId); - if (!$this->training) { + $training = $this->trainingDates->get($this->dateId); + if (!$training) { throw new BadRequestException("Date id {$param} does not exist, yet"); } + $this->training = $training; $validCount = 0; $applications = $discarded = []; foreach ($this->trainingApplications->getByDate($this->dateId) as $application) { @@ -151,13 +155,17 @@ public function actionReview(int $param): void } + /** + * @throws BadRequestException + */ public function actionApplication(int $param): void { $this->applicationId = $param; - $this->application = $this->trainingApplications->getApplicationById($this->applicationId); - if (!$this->application) { + $application = $this->trainingApplications->getApplicationById($this->applicationId); + if (!$application) { throw new BadRequestException("No application with id {$this->applicationId}"); } + $this->application = $application; if (isset($this->application->dateId)) { $this->dateId = $this->application->dateId;