changed params from array to Nameserver
Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
parent
b862611433
commit
b2452d349a
|
@ -13,7 +13,8 @@ use PDOException;
|
||||||
class NameserverRepository
|
class NameserverRepository
|
||||||
{
|
{
|
||||||
public function __construct(private DatabaseConnection $databaseConnection)
|
public function __construct(private DatabaseConnection $databaseConnection)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,20 +94,21 @@ class NameserverRepository
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param String $name
|
* @param \App\Entity\Nameserver $nameserver
|
||||||
* @param String $a
|
|
||||||
* @param String $aaaa
|
|
||||||
* @param String $apikey
|
|
||||||
*
|
*
|
||||||
* @return string|false
|
* @return string|false
|
||||||
*/
|
*/
|
||||||
public function insert(string $name, string $a, string $aaaa, String $apikey): bool|string
|
public function insert(Nameserver $nameserver): bool|string
|
||||||
{
|
{
|
||||||
$sql = "
|
$sql = "
|
||||||
INSERT INTO " . DatabaseConnection::TABLE_NAMESERVERS . " (name, a, aaaa, apikey)
|
INSERT INTO " . DatabaseConnection::TABLE_NAMESERVERS . " (name, a, aaaa, apikey)
|
||||||
VALUES (:name, :a, :aaaa, :apikey)";
|
VALUES (:name, :a, :aaaa, :apikey)";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
$name = $nameserver->getName();
|
||||||
|
$a = $nameserver->getA();
|
||||||
|
$aaaa = $nameserver->getAaaa();
|
||||||
|
$apikey = $nameserver->getApikey();
|
||||||
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
$statement = $this->databaseConnection->getConnection()->prepare(query: $sql);
|
||||||
$statement->bindParam(param: ':name', var: $name);
|
$statement->bindParam(param: ':name', var: $name);
|
||||||
$statement->bindParam(param: ':a', var: $a);
|
$statement->bindParam(param: ':a', var: $a);
|
||||||
|
@ -130,7 +132,7 @@ class NameserverRepository
|
||||||
*
|
*
|
||||||
* @return false|int
|
* @return false|int
|
||||||
*/
|
*/
|
||||||
public function update(int $id, string $name, string $a, string $aaaa, String $apikey): bool|int
|
public function update(int $id, string $name, string $a, string $aaaa, string $apikey): bool|int
|
||||||
{
|
{
|
||||||
$current = $this->findByID(id: $id);
|
$current = $this->findByID(id: $id);
|
||||||
|
|
||||||
|
@ -210,7 +212,7 @@ class NameserverRepository
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getLongestEntry(String $field): int
|
public function getLongestEntry(string $field): int
|
||||||
{
|
{
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT MAX(LENGTH(" . $field . ")) as length FROM " . DatabaseConnection::TABLE_NAMESERVERS;
|
SELECT MAX(LENGTH(" . $field . ")) as length FROM " . DatabaseConnection::TABLE_NAMESERVERS;
|
||||||
|
|
Loading…
Reference in New Issue