summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJimmy Huynh <jimmy.huynh@etu.unistra.fr>2021-03-13 00:45:32 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-03-17 08:58:42 +0100
commitf21738471675367e5dd09b78808f64830549673c (patch)
treee14203ac8283cf8fbbbe69d6b1a88f2b46ebb5f2
parent0da1c1614508e532f5ce4cfcbf8e12efeddd1dff (diff)
✨ Update 'Item' model: add 'tags' field
Signed-off-by: Jimmy Huynh <jimmy.huynh@etu.unistra.fr>
-rw-r--r--lib/Db/Item.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/Db/Item.php b/lib/Db/Item.php
index abfcf6506..6ae0d7975 100644
--- a/lib/Db/Item.php
+++ b/lib/Db/Item.php
@@ -63,6 +63,8 @@ class Item extends Entity implements IAPI, \JsonSerializable
protected $unread = false;
/** @var bool */
protected $starred = false;
+ /** @var string|null */
+ protected $tags;
public function __construct()
{
@@ -85,6 +87,7 @@ class Item extends Entity implements IAPI, \JsonSerializable
$this->addType('fingerprint', 'string');
$this->addType('unread', 'boolean');
$this->addType('starred', 'boolean');
+ $this->addType('tags', 'string');
}
/**
@@ -276,6 +279,14 @@ class Item extends Entity implements IAPI, \JsonSerializable
}
/**
+ * @return null|string
+ */
+ public function getTags(): ?string
+ {
+ return $this->tags;
+ }
+
+ /**
* Turns entity attributes into an array
*/
public function jsonSerialize(): array
@@ -505,6 +516,16 @@ class Item extends Entity implements IAPI, \JsonSerializable
return $this;
}
+ public function setTags(string $tags): self
+ {
+ if ($this->tags !== $tags) {
+ $this->tags = $tags;
+ $this->markFieldUpdated('tags');
+ }
+
+ return $this;
+ }
+
public function toAPI(): array
{
return [