Merge pull request 'bugfix/fix-ambiguous-sql-field-names' (!65) from bugfix/fix-ambiguous-sql-field-names into develop
All checks were successful
mapguesser/pipeline/head This commit looks good

Reviewed-on: #65
This commit is contained in:
Bence Pőcze 2023-05-02 18:12:04 +02:00 committed by Gitea
commit 10f032a9a5
Signed by: Gitea
GPG Key ID: 7B89B83EED9AD2C6
7 changed files with 26 additions and 26 deletions

View File

@ -10,7 +10,7 @@
} }
], ],
"require": { "require": {
"esoko/soko-web": "0.10", "esoko/soko-web": "0.10.1",
"fzaninotto/faker": "^1.9" "fzaninotto/faker": "^1.9"
}, },
"require-dev": { "require-dev": {

8
composer.lock generated
View File

@ -4,15 +4,15 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "db04b12ad70bbdfe83841fa292277ec6", "content-hash": "27b6af78f89ef8dde87e918118511571",
"packages": [ "packages": [
{ {
"name": "esoko/soko-web", "name": "esoko/soko-web",
"version": "0.10", "version": "v0.10.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://git.esoko.eu/esoko/soko-web.git", "url": "https://git.esoko.eu/esoko/soko-web.git",
"reference": "fd286c9cffadc4a26609bfa00944f8014a2f3f59" "reference": "585d469b695365e6f8c0f9b596dbb18b6d3ce584"
}, },
"require": { "require": {
"phpmailer/phpmailer": "^6.8", "phpmailer/phpmailer": "^6.8",
@ -33,7 +33,7 @@
"GNU GPL 3.0" "GNU GPL 3.0"
], ],
"description": "Lightweight web framework", "description": "Lightweight web framework",
"time": "2023-05-02T10:55:47+00:00" "time": "2023-05-02T16:06:33+00:00"
}, },
{ {
"name": "fzaninotto/faker", "name": "fzaninotto/faker",

View File

@ -40,7 +40,7 @@ class ChallengeRepository
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('user_in_challenge', ['challenge', 'id'], '=', ['user_in_challenge', 'challenge_id']); $select->innerJoin('user_in_challenge', ['challenge', 'id'], '=', ['user_in_challenge', 'challenge_id']);
$select->innerJoin('users', ['users', 'id'], '=', ['user_in_challenge', 'user_id']); $select->innerJoin('users', ['users', 'id'], '=', ['user_in_challenge', 'user_id']);
$select->where('user_id', '=', $user->getId()); $select->where(['user_in_challenge', 'user_id'], '=', $user->getId());
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class);
} }
@ -50,8 +50,8 @@ class ChallengeRepository
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('user_in_challenge', ['challenge', 'id'], '=', ['user_in_challenge', 'challenge_id']); $select->innerJoin('user_in_challenge', ['challenge', 'id'], '=', ['user_in_challenge', 'challenge_id']);
$select->innerJoin('users', ['users', 'id'], '=', ['user_in_challenge', 'user_id']); $select->innerJoin('users', ['users', 'id'], '=', ['user_in_challenge', 'user_id']);
$select->where('user_id', '=', $user->getId()); $select->where(['user_in_challenge', 'user_id'], '=', $user->getId());
$select->where('is_owner', '=', true); $select->where(['user_in_challenge', 'is_owner'], '=', true);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class);
} }
@ -60,7 +60,7 @@ class ChallengeRepository
{ {
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['challenges', 'id'], '=', ['place_in_challenge', 'challenge_id']); $select->innerJoin('place_in_challenge', ['challenges', 'id'], '=', ['place_in_challenge', 'challenge_id']);
$select->where('place_id', '=', $place->getId()); $select->where(['place_in_challenge', 'place_id'], '=', $place->getId());
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class);
} }

View File

@ -23,7 +23,7 @@ class GuessRepository
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']); $select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
$select->where('user_id', '=', $user->getId()); $select->where('user_id', '=', $user->getId());
$select->where('challenge_id', '=', $challenge->getId()); $select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class);
} }
@ -33,8 +33,8 @@ class GuessRepository
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']); $select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
$select->where('user_id', '=', $user->getId()); $select->where('user_id', '=', $user->getId());
$select->where('challenge_id', '=', $challenge->getId()); $select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->where('place_id', '=', $place->getId()); $select->where(['place_in_challenge', 'place_id'], '=', $place->getId());
return \Container::$persistentDataManager->selectFromDb($select, Guess::class); return \Container::$persistentDataManager->selectFromDb($select, Guess::class);
} }
@ -44,8 +44,8 @@ class GuessRepository
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']); $select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
$select->where('user_id', '=', $userId); $select->where('user_id', '=', $userId);
$select->where('challenge_id', '=', $challenge->getId()); $select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->orderBy('round'); $select->orderBy(['place_in_challenge', 'round']);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class);
} }
@ -58,8 +58,8 @@ class GuessRepository
} }
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->where('challenge_id', '=', $challenge->getId()); $select->where(['guesses__place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->orderBy('round'); $select->orderBy(['guesses__place_in_challenge', 'round']);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class, true, $withRelations); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class, true, $withRelations);
} }
@ -72,8 +72,8 @@ class GuessRepository
} }
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->where('challenge_id', '=', $challenge->getId()); $select->where(['guesses__place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->where('round', '=', $round); $select->where(['guesses__place_in_challenge', 'round'], '=', $round);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class, true, $withRelations); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class, true, $withRelations);
} }
@ -82,7 +82,7 @@ class GuessRepository
{ {
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']); $select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
$select->where('place_id', '=', $place->getId()); $select->where(['place_in_challenge', 'place_id'], '=', $place->getId());
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class);
} }

View File

@ -22,7 +22,7 @@ class MapRepository
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('places', ['maps', 'id'], '=', ['places', 'map_id']); $select->innerJoin('places', ['maps', 'id'], '=', ['places', 'map_id']);
$select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']); $select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']);
$select->where('challenge_id', '=', $challenge->getId()); $select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->limit(1); $select->limit(1);
return \Container::$persistentDataManager->selectFromDb($select, Map::class); return \Container::$persistentDataManager->selectFromDb($select, Map::class);

View File

@ -110,7 +110,7 @@ class PlaceRepository
$selectUnvisited = new Select(\Container::$dbConnection, 'places'); $selectUnvisited = new Select(\Container::$dbConnection, 'places');
$selectUnvisited->leftJoin($selectPlacesByCurrentUser, ['places', 'id'], '=', ['places_by_current_user', 'place_id']); $selectUnvisited->leftJoin($selectPlacesByCurrentUser, ['places', 'id'], '=', ['places_by_current_user', 'place_id']);
$selectUnvisited->where('map_id', '=', $mapId); $selectUnvisited->where('map_id', '=', $mapId);
$selectUnvisited->where('last_time', '=', null); $selectUnvisited->where(['places_by_current_user', 'last_time'], '=', null);
$numberOfUnvisitedPlaces = $selectUnvisited->count(); $numberOfUnvisitedPlaces = $selectUnvisited->count();
// look for as many new places as possible but maximum $n // look for as many new places as possible but maximum $n
@ -174,8 +174,8 @@ class PlaceRepository
{ {
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']); $select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']);
$select->where('challenge_id', '=', $challenge->getId()); $select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->orderBy('round'); $select->orderBy(['place_in_challenge', 'round']);
$select->limit(1, $round); $select->limit(1, $round);
return \Container::$persistentDataManager->selectFromDb($select, Place::class); return \Container::$persistentDataManager->selectFromDb($select, Place::class);
@ -185,8 +185,8 @@ class PlaceRepository
{ {
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']); $select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']);
$select->where('challenge_id', '=', $challenge->getId()); $select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
$select->orderBy('round'); $select->orderBy(['place_in_challenge', 'round']);
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Place::class); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Place::class);
} }

View File

@ -57,7 +57,7 @@ class UserInChallengeRepository
$select = new Select(\Container::$dbConnection); $select = new Select(\Container::$dbConnection);
$select->where('user_id', '=', $userId); $select->where('user_id', '=', $userId);
$select->where('token', '=', $token); $select->where(['user_in_challenge__challenge', 'token'], '=', $token);
return \Container::$persistentDataManager->selectFromDb($select, UserInChallenge::class, true, $withRelations); return \Container::$persistentDataManager->selectFromDb($select, UserInChallenge::class, true, $withRelations);
} }