fixed select statement

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-01-31 20:50:32 +01:00
parent 53fc1456d1
commit 74f3f40adf

View File

@ -81,7 +81,7 @@ class ApikeyRepository
public function findByPrefix(String $prefix): Apikey|bool
{
$sql = "
SELECT name, api_token
SELECT id, name, api_token_prefix, api_token
FROM " . DatabaseConnection::TABLE_APIKEYS . "
WHERE api_token_prefix = :prefix";
@ -90,7 +90,7 @@ class ApikeyRepository
$statement->bindParam(param: ':prefix', var: $prefix);
$statement->execute();
if ($result = $statement->fetch(mode: PDO::FETCH_ASSOC)) {
return new Apikey(name: $result['name'], apiTokenPrefix: $result['api_token_prefix'], apiToken: $result['api_token_result'], id: $result['id']);
return new Apikey(name: $result['name'], apiTokenPrefix: $result['api_token_prefix'], apiToken: $result['api_token'], id: $result['id']);
} else {
return false;
}