Use query builder
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
5f71805c35
commit
a5ddd65c10
|
@ -42,8 +42,12 @@ class AccessTokenMapper extends Mapper {
|
||||||
$qb
|
$qb
|
||||||
->select('*')
|
->select('*')
|
||||||
->from($this->tableName)
|
->from($this->tableName)
|
||||||
->where($qb->expr()->eq('hashed_code', $qb->createParameter('hashedCode')));
|
->where($qb->expr()->eq('hashed_code', $qb->createNamedParameter(hash('sha512', $code))));
|
||||||
|
$result = $qb->execute();
|
||||||
return $this->findEntity($qb->getSQL(), [hash('sha512', $code)]);
|
$rows = $result->fetchAll();
|
||||||
|
$result->closeCursor();
|
||||||
|
return array_map(function ($row) {
|
||||||
|
return AccessToken::fromRow($row);
|
||||||
|
}, $rows);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,13 @@ class ClientMapper extends Mapper {
|
||||||
$qb
|
$qb
|
||||||
->select('*')
|
->select('*')
|
||||||
->from($this->tableName)
|
->from($this->tableName)
|
||||||
->where($qb->expr()->eq('client_identifier', $qb->createParameter('clientId')));
|
->where($qb->expr()->eq('client_identifier', $qb->createNamedParameter($clientIdentifier)));
|
||||||
|
$result = $qb->execute();
|
||||||
return $this->findEntity($qb->getSQL(), [$clientIdentifier]);
|
$rows = $result->fetchAll();
|
||||||
|
$result->closeCursor();
|
||||||
|
return array_map(function ($row) {
|
||||||
|
return Client::fromRow($row);
|
||||||
|
}, $rows);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue