Use query builder

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2017-05-04 23:55:38 +02:00
parent 5f71805c35
commit a5ddd65c10
No known key found for this signature in database
GPG key ID: B9F6980CF6E759B1
2 changed files with 14 additions and 6 deletions

View file

@ -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);
}
}

View file

@ -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);
}
/**