diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2017-05-04 23:55:38 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@statuscode.ch> | 2017-05-18 20:49:03 +0200 |
commit | a5ddd65c10ff8812f6b49bc9703a2858a6c323e6 (patch) | |
tree | e0d13fcacd14d418ce1276175de89ad91a7dad1a /apps | |
parent | 5f71805c35d04e585ea6d4227254b11204413dfd (diff) | |
download | nextcloud-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.php | 10 | ||||
-rw-r--r-- | apps/oauth2/lib/Db/ClientMapper.php | 10 |
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); } /** |