From ea409dae07993e734bfc38a3b9ebdf3ace896bde Mon Sep 17 00:00:00 2001 From: NOrtmann1 <145041949+NOrtmann1@users.noreply.github.com> Date: Fri, 29 May 2026 17:20:07 +0200 Subject: [PATCH] Update LocalArticleManager.php --- php/model/LocalArticleManager.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/php/model/LocalArticleManager.php b/php/model/LocalArticleManager.php index b3e84cd..f686127 100644 --- a/php/model/LocalArticleManager.php +++ b/php/model/LocalArticleManager.php @@ -97,5 +97,25 @@ class LocalArticleManager implements ArticleManagerDAO { return is_array($articles) ? $articles : []; } + public function getArticlesByAuthor($author) + { + $articles = $this->getAllArticles(); + $filteredArticles = []; + + foreach ($articles as $article) { + if (isset($article['author']) && $article['author'] == $author) { + $filteredArticles[] = new Article( + intval($article['id']), + $article['title'], + $article['content'], + $article['author'], + $article['category'], + $article['tags'], + $article['creationDate'] + ); + } + } + return $filteredArticles; + } } ?> \ No newline at end of file