internship 3 years ago
parent
commit
c3219c485c
2 changed files with 10 additions and 0 deletions
  1. 1 0
      .gitignore
  2. 9 0
      src-php/app/internship/bo/Article.php

+ 1 - 0
.gitignore

@@ -2,3 +2,4 @@
 /.idea/shelf
 /src-php/huii.sql
 /src-php/.phpunit.result.cache
+/.phpunit.result.cache

+ 9 - 0
src-php/app/internship/bo/Article.php

@@ -62,4 +62,13 @@ class Article {
 	public function setTitle(string $title): void {
 		$this->title = $title;
 	}
+
+    function jsonSerialize(): mixed {
+        return [
+            'id' => $this->id,
+            'title' => $this->title,
+            'categoryName' => $this->categoryName,
+            'text' => $this->text
+        ];
+    }
 }