Add table to doc util script
- Remove db parameter from several places - Add constructors for document types
This commit is contained in:
@@ -14,35 +14,24 @@ use BitBadger\Documents\SQLite\Parameters;
|
||||
*/
|
||||
class Item
|
||||
{
|
||||
/** @var int The ID of this item in the Feed Reader Central database */
|
||||
public int $id = 0;
|
||||
|
||||
/** @var int The ID of the feed to which this item belongs */
|
||||
public int $feed_id = 0;
|
||||
|
||||
/** @var string The title of this item */
|
||||
public string $title = '';
|
||||
|
||||
/** @var string The Globally Unique ID (GUID) for this item (an attribute in the feed XML) */
|
||||
public string $item_guid = '';
|
||||
|
||||
/** @var string The link to the item on its original site */
|
||||
public string $item_link = '';
|
||||
|
||||
/** @var string The date/time this item was published */
|
||||
public string $published_on = '';
|
||||
|
||||
/** @var string|null The date/time this item was last updated */
|
||||
public ?string $updated_on = null;
|
||||
|
||||
/** @var string The content for this item */
|
||||
public string $content = '';
|
||||
|
||||
/** @var int 1 if the item has been read, 0 if not */
|
||||
public int $is_read = 0;
|
||||
|
||||
/** @var int 1 if the item is bookmarked, 0 if not */
|
||||
public int $is_bookmarked = 0;
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id The ID of this item in the Feed Reader Central database
|
||||
* @param int $feed_id The ID of the feed to which this item belongs
|
||||
* @param string $title The title of this item
|
||||
* @param string $item_guid The Globally Unique ID (GUID) for this item (an attribute in the feed XML)
|
||||
* @param string $item_link The link to the item on its original site
|
||||
* @param string $published_on The date/time this item was published
|
||||
* @param string|null $updated_on The date/time this item was last updated
|
||||
* @param string $content The content for this item
|
||||
* @param int $is_read 1 if the item has been read, 0 if not
|
||||
* @param int $is_bookmarked 1 if the item is bookmarked, 0 if not
|
||||
*/
|
||||
public function __construct(public int $id = 0, public int $feed_id = 0, public string $title = '',
|
||||
public string $item_guid = '', public string $item_link = '',
|
||||
public string $published_on = '', public ?string $updated_on = null,
|
||||
public string $content = '', public int $is_read = 0, public int $is_bookmarked = 0) { }
|
||||
|
||||
/**
|
||||
* Has the item been read?
|
||||
@@ -73,16 +62,14 @@ class Item
|
||||
*/
|
||||
public static function fromFeedItem(int $feedId, ParsedItem $item): static
|
||||
{
|
||||
$it = new static();
|
||||
$it->feed_id = $feedId;
|
||||
$it->item_guid = $item->guid;
|
||||
$it->item_link = $item->link;
|
||||
$it->title = $item->title;
|
||||
$it->published_on = $item->publishedOn;
|
||||
$it->updated_on = $item->updatedOn;
|
||||
$it->content = $item->content;
|
||||
|
||||
return $it;
|
||||
return new static(
|
||||
feed_id: $feedId,
|
||||
title: $item->title,
|
||||
item_guid: $item->guid,
|
||||
item_link: $item->link,
|
||||
published_on: $item->publishedOn,
|
||||
updated_on: $item->updatedOn,
|
||||
content: $item->content);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user