summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2017-05-04 23:55:38 +0200
committerLukas Reschke <lukas@statuscode.ch>2017-05-18 20:49:03 +0200
commita5ddd65c10ff8812f6b49bc9703a2858a6c323e6 (patch)
treee0d13fcacd14d418ce1276175de89ad91a7dad1a /apps
parent5f71805c35d04e585ea6d4227254b11204413dfd (diff)
downloadnextcloud-server-a5ddd65c10ff8812f6b49bc9703a2858a6c323e6.tar.gz
nextcloud-server-a5ddd65c10ff8812f6b49bc9703a2858a6c323e6.zip
Use query builder
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'apps')
-rw-r--r--apps/oauth2/lib/Db/AccessTokenMapper.php10
-rw-r--r--apps/oauth2/lib/Db/ClientMapper.php10
2 files changed, 14 insertions, 6 deletions
diff --git a/apps/oauth2/lib/Db/AccessTokenMapper.php b/apps/oauth2/lib/Db/AccessTokenMapper.php
index 0400ad6366c..0b54d5c3da4 100644
--- a/apps/oauth2/lib/Db/AccessTokenMapper.php
+++ b/apps/oauth2/lib/Db/AccessTokenMapper.php
@@ -42,8 +42,12 @@ class AccessTokenMapper extends Mapper {
$qb
->select('*')
->from($this->tableName)
- ->where($qb->expr()->eq('hashed_code', $qb->createParameter('hashedCode')));
-
- return $this->findEntity($qb->getSQL(), [hash('sha512', $code)]);
+ ->where($qb->expr()->eq('hashed_code', $qb->createNamedParameter(hash('sha512', $code))));
+ $result = $qb->execute();
+ $rows = $result->fetchAll();
+ $result->closeCursor();
+ return array_map(function ($row) {
+ return AccessToken::fromRow($row);
+ }, $rows);
}
}
diff --git a/apps/oauth2/lib/Db/ClientMapper.php b/apps/oauth2/lib/Db/ClientMapper.php
index d3c09ac5c69..8d1f26ce471 100644
--- a/apps/oauth2/lib/Db/ClientMapper.php
+++ b/apps/oauth2/lib/Db/ClientMapper.php
@@ -42,9 +42,13 @@ class ClientMapper extends Mapper {
$qb
->select('*')
->from($this->tableName)
- ->where($qb->expr()->eq('client_identifier', $qb->createParameter('clientId')));
-
- return $this->findEntity($qb->getSQL(), [$clientIdentifier]);
+ ->where($qb->expr()->eq('client_identifier', $qb->createNamedParameter($clientIdentifier)));
+ $result = $qb->execute();
+ $rows = $result->fetchAll();
+ $result->closeCursor();
+ return array_map(function ($row) {
+ return Client::fromRow($row);
+ }, $rows);
}
/**