. * */ namespace OCA\News\Db; use \OCA\AppFramework\Db\Entity; class Feed extends Entity implements IAPI { public $userId; public $urlHash; public $url; public $title; public $faviconLink; public $added; public $folderId; public $unreadCount; public $link; public $preventUpdate; public $deletedAt; public $articlesPerUpdate; public function __construct(){ $this->addType('parentId', 'int'); $this->addType('added', 'int'); $this->addType('folderId', 'int'); $this->addType('unreadCount', 'int'); $this->addType('preventUpdate', 'bool'); $this->addType('deletedAt', 'int'); $this->addType('articlesPerUpdate', 'int'); } public function toAPI() { return array( 'id' => $this->getId(), 'url' => $this->getUrl(), 'title' => $this->getTitle(), 'faviconLink' => $this->getFaviconLink(), 'added' => $this->getAdded(), 'folderId' => $this->getFolderId(), 'unreadCount' => $this->getUnreadCount(), 'link' => $this->getLink() ); } public function setUrl($url) { $url = trim($url); if(strpos($url, 'http') === 0) { parent::setUrl($url); $this->setUrlHash(md5($url)); } } public function setLink($url) { $url = trim($url); if(strpos($url, 'http') === 0) { parent::setLink($url); } } }