From 0da3c160df7f2af1b7800e70a2eba8c04126f3d4 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 2 May 2013 12:44:17 +0200 Subject: add serialize method for api --- db/item.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'db/item.php') diff --git a/db/item.php b/db/item.php index e24835226..6a627d8ff 100644 --- a/db/item.php +++ b/db/item.php @@ -28,7 +28,7 @@ namespace OCA\News\Db; use \OCA\AppFramework\Db\Entity; -class Item extends Entity { +class Item extends Entity implements IAPI { public $guidHash; public $guid; @@ -88,5 +88,25 @@ class Item extends Entity { return !$this->isStarred(); } + + public function toAPI() { + return array( + 'id' => $this->getId(), + 'guid' => $this->getGuid(), + 'guidHash' => $this->getGuidHash(), + 'url' => $this->getUrl(), + 'title' => $this->getTitle(), + 'author' => $this->getAuthor(), + 'pubDate' => $this->getPubDate(), + 'body' => $this->getBody(), + 'enclosureMime' => $this->getEnclosureMime(), + 'enclosureLink' => $this->getEnclosureLink(), + 'feedId' => $this->getFeedId(), + 'unread' => $this->isUnread(), + 'starred' => $this->isStarred(), + 'lastModified' => $this->getLastModified() + ); + } + } -- cgit v1.2.3