pdm = new PersistentDataManager(); } public function getAllByPlace(Place $place, array $withRelations = []) : Generator { $select = new Select(\Container::$dbConnection); $select->where('place_id', '=', $place->getId()); yield from $this->pdm->selectMultipleFromDb($select, PlaceInChallenge::class, true, $withRelations); } public function getAllByChallenge(Challenge $challenge) : Generator { $select = new Select(\Container::$dbConnection); $select->where('challenge_id', '=', $challenge->getId()); yield from $this->pdm->selectMultipleFromDb($select, PlaceInChallenge::class); } public function getByPlaceAndChallenge(Place $place, Challenge $challenge) : ?PlaceInChallenge { $select = new Select(\Container::$dbConnection); $select->where('place_id', '=', $place->getId()); $select->where('challenge_id', '=', $challenge->getId()); return $this->pdm->selectFromDb($select, PlaceInChallenge::class); } public function getByRoundInChallenge(int $round, Challenge $challenge, array $withRelations = []): ?PlaceInChallenge { $select = new Select(\Container::$dbConnection); $select->where('challenge_id', '=', $challenge->getId()); $select->orderBy('round'); $select->limit(1, $round); return $this->pdm->selectFromDb($select, PlaceInChallenge::class, true, $withRelations); } }