selectFromDbById($id, OAuthSession::class); } public function getByCode(string $code): ?OAuthSession { $select = new Select(\Container::$dbConnection); $select->where('code', '=', $code); return \Container::$persistentDataManager->selectFromDb($select, OAuthSession::class); } public function getAllExpired(): Generator { $select = new Select(\Container::$dbConnection); $select->where('expires', '<', (new DateTime())->format('Y-m-d H:i:s')); yield from \Container::$persistentDataManager->selectMultipleFromDb($select, OAuthSession::class); } }