Compare commits

..

2 Commits

Author SHA1 Message Date
niklas.ortmann b81f0c9e5c Update DatabaseArticleManager.php 2026-07-19 16:28:29 +02:00
niklas.ortmann f8aed4283e Update dataSources.local.xml 2026-07-19 16:28:27 +02:00
2 changed files with 11 additions and 10 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="dataSourceStorageLocal" created-in="IU-261.24374.151">
<component name="dataSourceStorageLocal" created-in="IU-261.25134.95">
<data-source name="articles" uuid="315cb5c9-2b0f-435b-b602-59823b160908">
<database-info product="SQLite" version="3.51.1" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.51.1.0" dbms="SQLITE" exact-version="3.51.1" exact-driver-version="3.51">
<identifier-quote-string>&quot;</identifier-quote-string>
+10 -9
View File
@@ -310,21 +310,20 @@ class DatabaseArticleManager implements ArticleManagerDAO {
try {
$db = $this->getConnection();
$sql = "SELECT id, title, content, author, category, tags, created
FROM articles
WHERE title LIKE :keyword
OR content LIKE :keyword
OR tags LIKE :keyword";
FROM articles
WHERE title LIKE :keyword
OR content LIKE :keyword
OR tags LIKE :keyword;";
$command = $db->prepare($sql);
if (!$command) {
throw new InternalServerErrorException("internal_error");
}
// Wildcards für die Suche hinzufügen
// Wildcards für die SQL-Suche hinzufügen
$searchParam = '%' . $cleankeyword . '%';
$success = $command->execute([
":keyword" => $searchParam
]);
@@ -337,10 +336,11 @@ class DatabaseArticleManager implements ArticleManagerDAO {
$filteredArticles = [];
foreach ($rows as $row) {
$likes = $this->getLikesForArticle(intval($row['id']));
$articleId = intval($row['id']);
$likes = $this->getLikesForArticle($articleId);
$filteredArticles[] = new Article(
intval($row['id']),
$articleId,
$row['title'] ?? '',
$row['content'] ?? '',
$row['author'] ?? '',
@@ -358,6 +358,7 @@ class DatabaseArticleManager implements ArticleManagerDAO {
}
}
/**
* Holt alle User-IDs, die einen bestimmten Beitrag geliked haben.
*