Use query builder
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
5f71805c35
commit
a5ddd65c10
2 changed files with 14 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue