Forum implementiert #34

Merged
niklas.ortmann merged 20 commits from Forum into dev 2026-06-17 10:24:25 +02:00
2 changed files with 17 additions and 4 deletions
Showing only changes of commit f23ec27247 - Show all commits
+1 -1
View File
@@ -80,7 +80,7 @@ class Comment
*/
public function isReply(): bool
{
return $this->parentCommentId !== null;
return $this->parentCommentId !== null && $this->parentCommentId !== 0;
}
/**
+16 -3
View File
2
@@ -113,6 +113,10 @@ class DatabaseCommentManager implements CommentManagerDAO
try {
$db = $this->getConnection();
if ($parentCommentId === "" || $parentCommentId === 0 || $parentCommentId === "0") {
$parentCommentId = null;
}
$sql = "
INSERT INTO comments (
article_id,
1
@@ -173,12 +177,21 @@ class DatabaseCommentManager implements CommentManagerDAO
$comments = [];
caroline.slt marked this conversation as resolved Outdated
Outdated
Review

s. oben

s. oben
while ($row = $command->fetch(PDO::FETCH_ASSOC)) {
$parentCommentId = null;
if (
isset($row["parent_comment_id"])
&& $row["parent_comment_id"] !== null
&& $row["parent_comment_id"] !== ""
&& intval($row["parent_comment_id"]) !== 0
) {
$parentCommentId = intval($row["parent_comment_id"]);
}
$comments[] = new Comment(
intval($row["id"]),
intval($row["article_id"]),
isset($row["parent_comment_id"]) && $row["parent_comment_id"] !== null
? intval($row["parent_comment_id"])
: null,
$parentCommentId,
$row["author"],
$row["content"],
$row["created"]