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

View File

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