Get a single row

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2017-05-04 23:58:45 +02:00
parent a5ddd65c10
commit 0a2b57c93f
No known key found for this signature in database
GPG Key ID: B9F6980CF6E759B1
2 changed files with 4 additions and 8 deletions

View File

@ -44,10 +44,8 @@ class AccessTokenMapper extends Mapper {
->from($this->tableName) ->from($this->tableName)
->where($qb->expr()->eq('hashed_code', $qb->createNamedParameter(hash('sha512', $code)))); ->where($qb->expr()->eq('hashed_code', $qb->createNamedParameter(hash('sha512', $code))));
$result = $qb->execute(); $result = $qb->execute();
$rows = $result->fetchAll(); $row = $result->fetchAll();
$result->closeCursor(); $result->closeCursor();
return array_map(function ($row) { return AccessToken::fromRow($row);
return AccessToken::fromRow($row);
}, $rows);
} }
} }

View File

@ -44,11 +44,9 @@ class ClientMapper extends Mapper {
->from($this->tableName) ->from($this->tableName)
->where($qb->expr()->eq('client_identifier', $qb->createNamedParameter($clientIdentifier))); ->where($qb->expr()->eq('client_identifier', $qb->createNamedParameter($clientIdentifier)));
$result = $qb->execute(); $result = $qb->execute();
$rows = $result->fetchAll(); $row = $result->fetch();
$result->closeCursor(); $result->closeCursor();
return array_map(function ($row) { return Client::fromRow($row);
return Client::fromRow($row);
}, $rows);
} }
/** /**