MAPG-235 new challenge can be created and is prepared
This commit is contained in:
1 parent
99244e93d2
commit
d7147b30d6
14 files changed
+289
-17
No files matched your search
@@ -1,5 +1,7 @@
|
||||
<?php namespace MapGuesser\Repository;
|
||||
|
||||
use MapGuesser\Database\Query\Select;
|
||||
use MapGuesser\PersistentData\Model\Challenge;
|
||||
use MapGuesser\PersistentData\Model\Map;
|
||||
use MapGuesser\PersistentData\PersistentDataManager;
|
||||
|
||||
@@ -16,4 +18,15 @@ class MapRepository
|
||||
{
|
||||
return $this->pdm->selectFromDbById($mapId, Map::class);
|
||||
}
|
||||
|
||||
public function getByChallenge(Challenge $challenge): ?Map
|
||||
{
|
||||
$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->limit(1);
|
||||
|
||||
return $this->pdm->selectFromDb($select, Map::class);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user