bugfix/fix-ambiguous-sql-field-names #65
@ -40,7 +40,7 @@ class ChallengeRepository
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->innerJoin('user_in_challenge', ['challenge', 'id'], '=', ['user_in_challenge', 'challenge_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);
|
||||
}
|
||||
@ -50,8 +50,8 @@ class ChallengeRepository
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->innerJoin('user_in_challenge', ['challenge', 'id'], '=', ['user_in_challenge', 'challenge_id']);
|
||||
$select->innerJoin('users', ['users', 'id'], '=', ['user_in_challenge', 'user_id']);
|
||||
$select->where('user_id', '=', $user->getId());
|
||||
$select->where('is_owner', '=', true);
|
||||
$select->where(['user_in_challenge', 'user_id'], '=', $user->getId());
|
||||
$select->where(['user_in_challenge', 'is_owner'], '=', true);
|
||||
|
||||
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Challenge::class);
|
||||
}
|
||||
@ -60,7 +60,7 @@ class ChallengeRepository
|
||||
{
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$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);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class GuessRepository
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
|
||||
$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);
|
||||
}
|
||||
@ -33,8 +33,8 @@ class GuessRepository
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
|
||||
$select->where('user_id', '=', $user->getId());
|
||||
$select->where('challenge_id', '=', $challenge->getId());
|
||||
$select->where('place_id', '=', $place->getId());
|
||||
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
|
||||
$select->where(['place_in_challenge', 'place_id'], '=', $place->getId());
|
||||
|
||||
return \Container::$persistentDataManager->selectFromDb($select, Guess::class);
|
||||
}
|
||||
@ -44,8 +44,8 @@ class GuessRepository
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->innerJoin('place_in_challenge', ['place_in_challenge', 'id'], '=', ['guesses', 'place_in_challenge_id']);
|
||||
$select->where('user_id', '=', $userId);
|
||||
$select->where('challenge_id', '=', $challenge->getId());
|
||||
$select->orderBy('round');
|
||||
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
|
||||
$select->orderBy(['place_in_challenge', 'round']);
|
||||
|
||||
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class);
|
||||
}
|
||||
@ -58,8 +58,8 @@ class GuessRepository
|
||||
}
|
||||
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->where('challenge_id', '=', $challenge->getId());
|
||||
$select->orderBy('round');
|
||||
$select->where(['guesses__place_in_challenge', 'challenge_id'], '=', $challenge->getId());
|
||||
$select->orderBy(['guesses__place_in_challenge', 'round']);
|
||||
|
||||
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class, true, $withRelations);
|
||||
}
|
||||
@ -72,8 +72,8 @@ class GuessRepository
|
||||
}
|
||||
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->where('challenge_id', '=', $challenge->getId());
|
||||
$select->where('round', '=', $round);
|
||||
$select->where(['guesses__place_in_challenge', 'challenge_id'], '=', $challenge->getId());
|
||||
$select->where(['guesses__place_in_challenge', 'round'], '=', $round);
|
||||
|
||||
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Guess::class, true, $withRelations);
|
||||
}
|
||||
@ -82,7 +82,7 @@ class GuessRepository
|
||||
{
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$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);
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class MapRepository
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->innerJoin('places', ['maps', 'id'], '=', ['places', 'map_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);
|
||||
|
||||
return \Container::$persistentDataManager->selectFromDb($select, Map::class);
|
||||
|
@ -110,7 +110,7 @@ class PlaceRepository
|
||||
$selectUnvisited = new Select(\Container::$dbConnection, 'places');
|
||||
$selectUnvisited->leftJoin($selectPlacesByCurrentUser, ['places', 'id'], '=', ['places_by_current_user', 'place_id']);
|
||||
$selectUnvisited->where('map_id', '=', $mapId);
|
||||
$selectUnvisited->where('last_time', '=', null);
|
||||
$selectUnvisited->where(['places_by_current_user', 'last_time'], '=', null);
|
||||
$numberOfUnvisitedPlaces = $selectUnvisited->count();
|
||||
|
||||
// look for as many new places as possible but maximum $n
|
||||
@ -174,8 +174,8 @@ class PlaceRepository
|
||||
{
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']);
|
||||
$select->where('challenge_id', '=', $challenge->getId());
|
||||
$select->orderBy('round');
|
||||
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
|
||||
$select->orderBy(['place_in_challenge', 'round']);
|
||||
$select->limit(1, $round);
|
||||
|
||||
return \Container::$persistentDataManager->selectFromDb($select, Place::class);
|
||||
@ -185,8 +185,8 @@ class PlaceRepository
|
||||
{
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$select->innerJoin('place_in_challenge', ['places', 'id'], '=', ['place_in_challenge', 'place_id']);
|
||||
$select->where('challenge_id', '=', $challenge->getId());
|
||||
$select->orderBy('round');
|
||||
$select->where(['place_in_challenge', 'challenge_id'], '=', $challenge->getId());
|
||||
$select->orderBy(['place_in_challenge', 'round']);
|
||||
|
||||
yield from \Container::$persistentDataManager->selectMultipleFromDb($select, Place::class);
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class UserInChallengeRepository
|
||||
|
||||
$select = new Select(\Container::$dbConnection);
|
||||
$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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user