From eeda115e32a9798116cfa506d4bc23a744d8a9ac Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 19 May 2020 20:32:15 +0000 Subject: [PATCH] Adding some more verb handling --- src/Model/Item.php | 4 ++-- src/Model/Verb.php | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/Model/Item.php b/src/Model/Item.php index 006c70860..14e6d02ba 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -94,7 +94,7 @@ class Item // All fields in the item table const ITEM_FIELDLIST = ['id', 'uid', 'parent', 'uri', 'parent-uri', 'thr-parent', - 'guid', 'uri-id', 'parent-uri-id', 'thr-parent-id', + 'guid', 'uri-id', 'parent-uri-id', 'thr-parent-id', 'vid', 'contact-id', 'type', 'wall', 'gravity', 'extid', 'icid', 'iaid', 'psid', 'created', 'edited', 'commented', 'received', 'changed', 'verb', 'postopts', 'plink', 'resource-id', 'event-id', 'attach', 'inform', @@ -669,7 +669,7 @@ class Item $fields = []; $fields['item'] = ['id', 'uid', 'parent', 'uri', 'parent-uri', 'thr-parent', - 'guid', 'uri-id', 'parent-uri-id', 'thr-parent-id', + 'guid', 'uri-id', 'parent-uri-id', 'thr-parent-id', 'vid', 'contact-id', 'owner-id', 'author-id', 'type', 'wall', 'gravity', 'extid', 'created', 'edited', 'commented', 'received', 'changed', 'psid', 'resource-id', 'event-id', 'attach', 'post-type', 'file', diff --git a/src/Model/Verb.php b/src/Model/Verb.php index 46b306c1d..570c62d84 100644 --- a/src/Model/Verb.php +++ b/src/Model/Verb.php @@ -33,7 +33,7 @@ class Verb * @return integer verb id * @throws \Exception */ - public static function getID($verb) + public static function getID(string $verb) { if (empty($verb)) { return 0; @@ -48,4 +48,24 @@ class Verb return DBA::lastInsertId(); } + + /** + * Return verb name for the given ID + * + * @param integer $id + * @return string verb + */ + public static function getbyID(int $id) + { + if (empty($id)) { + return ''; + } + + $verb_record = DBA::selectFirst('verb', ['name'], ['id' => $id]); + if (!DBA::isResult($verb_record)) { + return ''; + } + + return $verb_record['name']; + } }