changed content to panel

Signed-off-by: tracer <tracer@24unix.net>
This commit is contained in:
tracer 2022-02-22 16:07:27 +01:00
parent b951e4d06e
commit 0f279764a8
1 changed files with 10 additions and 10 deletions

View File

@ -65,7 +65,7 @@ class DomainRepository
} }
$sql = " $sql = "
SELECT id, name, content SELECT id, name, name
FROM . " . DatabaseConnection::TABLE_DOMAINS . " FROM . " . DatabaseConnection::TABLE_DOMAINS . "
WHERE id = :id"; WHERE id = :id";
@ -75,7 +75,7 @@ class DomainRepository
$statement->execute(); $statement->execute();
if ($result = $statement->fetch(mode: PDO::FETCH_ASSOC)) { if ($result = $statement->fetch(mode: PDO::FETCH_ASSOC)) {
return new Domain(name: $result['name'], panel: $result['content'], id: $result['id']); return new Domain(name: $result['name'], panel: $result['panel'], id: $result['id']);
} else { } else {
return false; return false;
} }
@ -96,7 +96,7 @@ class DomainRepository
$this->log->debug(message: "findByName($name)"); $this->log->debug(message: "findByName($name)");
} }
$sql = " $sql = "
SELECT id, name, content SELECT id, name, panel
FROM " . DatabaseConnection::TABLE_DOMAINS . " FROM " . DatabaseConnection::TABLE_DOMAINS . "
WHERE name = :name"; WHERE name = :name";
@ -105,7 +105,7 @@ class DomainRepository
$statement->bindParam(param: ':name', var: $name); $statement->bindParam(param: ':name', var: $name);
$statement->execute(); $statement->execute();
if ($result = $statement->fetch(mode: PDO::FETCH_ASSOC)) { if ($result = $statement->fetch(mode: PDO::FETCH_ASSOC)) {
return new Domain(name: $result['name'], panel: $result['content'], id: $result['id']); return new Domain(name: $result['name'], panel: $result['panel'], id: $result['id']);
} else { } else {
return false; return false;
} }
@ -128,8 +128,8 @@ class DomainRepository
} }
$sql = " $sql = "
INSERT INTO " . DatabaseConnection::TABLE_DOMAINS . " (name, content) INSERT INTO " . DatabaseConnection::TABLE_DOMAINS . " (name, panel)
VALUES (:name, :content)"; VALUES (:name, :panel)";
try { try {
$name = $domain->getName(); $name = $domain->getName();
@ -167,22 +167,22 @@ class DomainRepository
$name = $domain->getName(); $name = $domain->getName();
} }
if (empty($domain->getPanel())) { if (empty($domain->getPanel())) {
$content = $current->getPanel(); $panel = $current->getPanel();
} else { } else {
$content = $domain->getPanel(); $panel = $domain->getPanel();
} }
$sql = " $sql = "
UPDATE " . DatabaseConnection::TABLE_DOMAINS . " SET UPDATE " . DatabaseConnection::TABLE_DOMAINS . " SET
name = :name, name = :name,
content = :content panel = :panel
WHERE id = :id"; WHERE id = :id";
try { try {
$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->bindParam(param: 'name', var: $name); $statement->bindParam(param: 'name', var: $name);
$statement->bindParam(param: 'content', var: $content); $statement->bindParam(param: 'panel', var: $panel);
$statement->execute(); $statement->execute();
return $statement->rowCount(); return $statement->rowCount();