added findFirst()
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
b90d91fda2
commit
0a67c16862
@ -42,6 +42,28 @@ class NameserverRepository
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return \App\Entity\Nameserver
|
||||
*/
|
||||
public function findFirst(): Nameserver
|
||||
{
|
||||
$nameservers = [];
|
||||
$sql = "
|
||||
SELECT id, name, a, aaaa, apikey
|
||||
FROM " . DatabaseConnection::TABLE_NAMESERVERS . "
|
||||
ORDER BY name";
|
||||
|
||||
try {
|
||||
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
$result = $statement->fetch(mode: PDO::FETCH_ASSOC);
|
||||
return new Nameserver(name: $result['name'], id: $result['id'], a: $result['a'], aaaa: $result['aaaa'], apikey: $result['apikey']);
|
||||
} catch (PDOException $e) {
|
||||
exit($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user