From 4aadcab2d20557f43da88347240fd7ac375a268c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 30 Apr 2023 20:29:43 +0200 Subject: [PATCH 1/2] update soko-web to 0.7 --- composer.json | 2 +- composer.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index f6a1293..9530fec 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ } ], "require": { - "esoko/soko-web": "0.6.1", + "esoko/soko-web": "0.7", "fzaninotto/faker": "^1.9" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 0422b2e..915f07c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,15 +4,15 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8b291ef6518a20a7cdd71ac2c19763d8", + "content-hash": "cadf44c9030f1d63cb602a2ddb77db7e", "packages": [ { "name": "esoko/soko-web", - "version": "0.6.1", + "version": "v0.7", "source": { "type": "git", "url": "https://git.esoko.eu/esoko/soko-web.git", - "reference": "445774e59a4891b2e67d151b0cf7b7b880c40e48" + "reference": "88a2a99527b51dfb240ec78ac7070dc36a1022b6" }, "require": { "phpmailer/phpmailer": "^6.8", @@ -33,7 +33,7 @@ "GNU GPL 3.0" ], "description": "Lightweight web framework", - "time": "2023-04-19T22:24:31+00:00" + "time": "2023-04-30T18:20:27+00:00" }, { "name": "fzaninotto/faker", -- 2.45.2 From e70f8a9965e2920b9118ba6cb173a5bebb0f9870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 30 Apr 2023 21:01:15 +0200 Subject: [PATCH 2/2] adapt $withRelations usage to soko-web 0.7 --- src/Controller/GameFlowController.php | 10 +++++----- src/Controller/MapAdminController.php | 2 +- src/Repository/GuessRepository.php | 4 ++-- src/Repository/UserInChallengeRepository.php | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Controller/GameFlowController.php b/src/Controller/GameFlowController.php index ff74dca..55f959f 100644 --- a/src/Controller/GameFlowController.php +++ b/src/Controller/GameFlowController.php @@ -138,7 +138,7 @@ class GameFlowController implements IAuthenticationRequired // if the last round was played ($currentPlace == null) or history is explicitly requested (for initializing) if (!isset($currentPlace) || $withHistory) { - $withRelations = [User::class, PlaceInChallenge::class, Place::class]; + $withRelations = ['user', 'place_in_challange', 'place']; foreach ($this->guessRepository->getAllInChallenge($challenge, $withRelations) as $guess) { $round = $guess->getPlaceInChallenge()->getRound(); @@ -187,7 +187,7 @@ class GameFlowController implements IAuthenticationRequired $prevRound = $currentRound - 1; if ($prevRound >= 0) { - foreach ($this->guessRepository->getAllInChallengeByRound($prevRound, $challenge, [User::class]) as $guess) { + foreach ($this->guessRepository->getAllInChallengeByRound($prevRound, $challenge, ['user']) as $guess) { if ($guess->getUser()->getId() != $userId) { $response['allResults'][] = [ 'userName' => $guess->getUser()->getDisplayName(), @@ -216,7 +216,7 @@ class GameFlowController implements IAuthenticationRequired $session = \Container::$request->session(); $userId = $session->get('userId'); $challengeToken_str = \Container::$request->query('challengeToken'); - $userInChallenge = $this->userInChallengeRepository->getByUserIdAndToken($userId, $challengeToken_str, [Challenge::class]); + $userInChallenge = $this->userInChallengeRepository->getByUserIdAndToken($userId, $challengeToken_str, ['challenge']); if (!isset($userInChallenge)) { return new JsonContent(['error' => 'game_not_found']); @@ -337,7 +337,7 @@ class GameFlowController implements IAuthenticationRequired $session = \Container::$request->session(); $userId = $session->get('userId'); $challengeToken_str = \Container::$request->query('challengeToken'); - $userInChallenge = $this->userInChallengeRepository->getByUserIdAndToken($userId, $challengeToken_str, [Challenge::class]); + $userInChallenge = $this->userInChallengeRepository->getByUserIdAndToken($userId, $challengeToken_str, ['challenge']); if (!isset($userInChallenge)) { return new JsonContent(['error' => 'game_not_found']); @@ -345,7 +345,7 @@ class GameFlowController implements IAuthenticationRequired $challenge = $userInChallenge->getChallenge(); $currentRound = $userInChallenge->getCurrentRound(); - $currentPlaceInChallenge = $this->placeInChallengeRepository->getByRoundInChallenge($currentRound, $challenge, [Place::class, Map::class]); + $currentPlaceInChallenge = $this->placeInChallengeRepository->getByRoundInChallenge($currentRound, $challenge, ['place', 'map']); $currentPlace = $currentPlaceInChallenge->getPlace(); $map = $currentPlace->getMap(); diff --git a/src/Controller/MapAdminController.php b/src/Controller/MapAdminController.php index dd9467b..e2db3e3 100644 --- a/src/Controller/MapAdminController.php +++ b/src/Controller/MapAdminController.php @@ -218,7 +218,7 @@ class MapAdminController implements IAuthenticationRequired, ISecured \Container::$persistentDataManager->deleteFromDb($userInChallenge); } - foreach ($this->guessRepository->getAllInChallenge($challenge, [PlaceInChallenge::class]) as $guess) { + foreach ($this->guessRepository->getAllInChallenge($challenge, ['place_in_challange']) as $guess) { \Container::$persistentDataManager->deleteFromDb($guess); } diff --git a/src/Repository/GuessRepository.php b/src/Repository/GuessRepository.php index 2baa6c8..e02e523 100644 --- a/src/Repository/GuessRepository.php +++ b/src/Repository/GuessRepository.php @@ -53,7 +53,7 @@ class GuessRepository public function getAllInChallenge(Challenge $challenge, array $withRelations = []): Generator { if (count($withRelations)) { - $necessaryRelations = [PlaceInChallenge::class]; + $necessaryRelations = ['place_in_challenge']; $withRelations = array_unique(array_merge($withRelations, $necessaryRelations)); } @@ -67,7 +67,7 @@ class GuessRepository public function getAllInChallengeByRound(int $round, Challenge $challenge, array $withRelations = []): Generator { if (count($withRelations)) { - $necessaryRelations = [PlaceInChallenge::class]; + $necessaryRelations = ['place_in_challenge']; $withRelations = array_unique(array_merge($withRelations, $necessaryRelations)); } diff --git a/src/Repository/UserInChallengeRepository.php b/src/Repository/UserInChallengeRepository.php index 3e7d5ab..db439fe 100644 --- a/src/Repository/UserInChallengeRepository.php +++ b/src/Repository/UserInChallengeRepository.php @@ -29,7 +29,7 @@ class UserInChallengeRepository $select = new Select(\Container::$dbConnection); $select->where('challenge_id', '=', $challenge->getId()); - yield from \Container::$persistentDataManager->selectMultipleFromDb($select, UserInChallenge::class, true, [User::class]); + yield from \Container::$persistentDataManager->selectMultipleFromDb($select, UserInChallenge::class, true, ['user']); } public function getByUserIdAndChallenge(int $userId, Challenge $challenge): ?UserInChallenge @@ -44,7 +44,7 @@ class UserInChallengeRepository public function getByUserIdAndToken(int $userId, string $token_str, array $withRelations = []): ?UserInChallenge { if (count($withRelations)) { - $necessaryRelations = [Challenge::class]; + $necessaryRelations = ['challange']; $withRelations = array_unique(array_merge($withRelations, $necessaryRelations)); } -- 2.45.2