From 74f3f40adf5db9665d63bad2297109e8f1b4b542 Mon Sep 17 00:00:00 2001 From: tracer Date: Mon, 31 Jan 2022 20:50:32 +0100 Subject: [PATCH] fixed select statement Signed-off-by: tracer --- src/Repository/ApikeyRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Repository/ApikeyRepository.php b/src/Repository/ApikeyRepository.php index 216d871..a274582 100644 --- a/src/Repository/ApikeyRepository.php +++ b/src/Repository/ApikeyRepository.php @@ -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; }