<?php
/**
* Nextcloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Alessandro Cosentino <cosenal@gmail.com>
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @author Paul Tirk <paultirk@paultirk.com>
* @copyright 2012 Alessandro Cosentino
* @copyright 2012-2014 Bernhard Posselt
* @copyright 2020 Paul Tirk
*/
namespace OCA\News\Db;
use OCP\AppFramework\Db\Entity;
/**
* Class Item
*
* @package OCA\News\Db
* @Embeddable
*/
class Item extends Entity implements IAPI, \JsonSerializable
{
use EntityJSONSerializer;
/** @var string|null */
protected $contentHash;
/** @var string */
protected $guidHash;
/** @var string */
protected $guid;
/** @var string|null */
protected $url;
/** @var string|null */
protected $title;
/** @var string|null */
protected $author;
/** @var int|null */
protected $pubDate;
/** @var string|null */
protected $body;
/** @var string|null */
protected $enclosureMime;
/** @var string|null */
protected $enclosureLink;
/** @var string|null */
protected $mediaThumbnail;
/** @var string|null */
protected $mediaDescription;
/** @var int */
protected $feedId;
/** @var string|null */
protected $lastModified = '0';
/** @var string|null */
protected $searchIndex;
/** @var bool */
protected $rtl = false;
/** @var string|null */
protected $fingerprint;
/** @var bool */
protected $unread = false;
/** @var bool */
protected $starred = false;
/** @var string|null */
protected $categoriesJson;
/** @var string|null */
protected $sharedBy;
/** @var string|null */
protected $sharedByDisplayName;
public function __construct()
{
$this->addType('contentHash', 'string');
$this->addType('guidHash', 'string');
$this->addType('guid', 'string');
$this->addType('url', 'string');
$this->addType('title', 'string');
$this->addType('author', 'string');
$this->addType('pubDate', 'integer');
$this->addType('body', 'string');
$this->addType('enclosureMime', 'string');
$this->addType('enclosureLink', 'string');
$this->addType('mediaThumbnail', 'string');
$this->addType('mediaDescription', 'string');
$this->addType('feedId', 'integer');
$this->addType('lastModified', 'string');
$this->addType('searchIndex', 'string');
$this->addType('rtl', 'boolean');
$this->addType('fingerprint', 'string');
$this->addType('unread', 'boolean');
$this->addType('starred', 'boolean');
$this->addType('categoriesJson', 'string');
$this->addType('sharedBy', 'string');
}
public function __clone()
{
$this->setId(null);
/**
* Removes 'id' from updatedFields; this will avoid explicitly
* inserting the value NULL into the DB, and will instead allow a new
* id to be generated.
* */
$this->resetUpdatedFields();
$this->markFieldUpdated('contentHash');
$this->markFieldUpdated('guidHash');
$this->markFieldUpdated('guid');
$this->markFieldUpdated('url');
$this->markFieldUpdated('title');
$this->markFieldUpdated('author');
$this->markFieldUpdated('pubDate');
$this->markFieldUpdated('body');
$this->markFieldUpdated('enclosureMime');
$this->markFieldUpdated('enclosureLink');
$this->markFieldUpdated('mediaThumbnail');
$this->markFieldUpdated('mediaDescription');
$this->markFieldUpdated('feedId');
$this->markFieldUpdated('lastModified');
$this->markFieldUpdated('searchIndex');
$this->markFieldUpdated('rtl');
$this->markFieldUpdated('fingerprint');
$this->markFieldUpdated('unread');
$this->markFieldUpdated('starred');
$this->markFieldUpdated('categor