Update LocalArticleManager.php

This commit is contained in:
2026-06-03 19:33:02 +02:00
parent e772a8b57f
commit e35d07ebc3
+21
View File
@@ -201,5 +201,26 @@ class LocalArticleManager implements ArticleManagerDAO {
return $filteredArticles;
}
public function getArticlesByCategory($category)
{
$articles = $this->getAllArticles();
$filteredArticles = [];
foreach ($articles as $article) {
if (isset($article['category']) && $article['category'] == $category) {
$filteredArticles[] = new Article(
intval($article['id']),
$article['title'],
$article['content'],
$article['author'],
$article['category'],
$article['tags'],
$article['creationDate']
);
}
}
return $filteredArticles;
}
}
?>