handled case domain not found
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
574b960ed1
commit
d1e67fce03
|
@ -48,9 +48,9 @@ class ApikeyRepository
|
||||||
/**
|
/**
|
||||||
* @param Int $id
|
* @param Int $id
|
||||||
*
|
*
|
||||||
* @return \App\Entity\Apikey
|
* @return \App\Entity\Apikey|bool
|
||||||
*/
|
*/
|
||||||
public function findByID(Int $id): Apikey
|
public function findByID(Int $id): Apikey|bool
|
||||||
{
|
{
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT id, name, api_token_prefix, api_token
|
SELECT id, name, api_token_prefix, api_token
|
||||||
|
@ -62,9 +62,11 @@ class ApikeyRepository
|
||||||
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||||
$statement->bindParam(param: ':id', var: $id);
|
$statement->bindParam(param: ':id', var: $id);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
$result = $statement->fetch(mode: PDO::FETCH_ASSOC);
|
if ($result = $statement->fetch(mode: PDO::FETCH_ASSOC)) {
|
||||||
print_r($result);
|
return new Apikey(name: $result['name'], apiTokenPrefix: $result['api_token_prefix'], apiToken: $result['api_token'], id: $result['id']);
|
||||||
return new Apikey(name: $result['name'], apiTokenPrefix: $result['api_token_prefix'], apiToken: $result['api_token'], id: $result['id']);
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
} catch (PDOException $e) {
|
} catch (PDOException $e) {
|
||||||
exit($e->getMessage());
|
exit($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue