MAPG-235 fixed place/map deletion

This commit is contained in:
balazs committed 2021-05-19 16:33:18 +02:00
1 parent 2a1b51b014
commit 517d758e8e
4 files changed
+59 -2

No files matched your search

+10
View File
@@ -3,6 +3,7 @@
use Generator;
use MapGuesser\Database\Query\Select;
use MapGuesser\PersistentData\Model\Challenge;
use MapGuesser\PersistentData\Model\Place;
use MapGuesser\PersistentData\Model\User;
use MapGuesser\PersistentData\PersistentDataManager;
@@ -55,4 +56,13 @@ class ChallengeRepository
yield from $this->pdm->selectMultipleFromDb($select, Challenge::class);
}
public function getAllByPlace(Place $place): Generator
{
$select = new Select(\Container::$dbConnection);
$select->innerJoin('place_in_challenge', ['challenges', 'id'], '=', ['place_in_challenge', 'challenge_id']);
$select->where('place_id', '=', $place->getId());
yield from $this->pdm->selectMultipleFromDb($select, Challenge::class);
}
}