Adding some more verb handling

This commit is contained in:
Michael 2020-05-19 20:32:15 +00:00
parent 929455bd01
commit eeda115e32
2 changed files with 23 additions and 3 deletions

View file

@ -94,7 +94,7 @@ class Item
// All fields in the item table // All fields in the item table
const ITEM_FIELDLIST = ['id', 'uid', 'parent', 'uri', 'parent-uri', 'thr-parent', 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', 'contact-id', 'type', 'wall', 'gravity', 'extid', 'icid', 'iaid', 'psid',
'created', 'edited', 'commented', 'received', 'changed', 'verb', 'created', 'edited', 'commented', 'received', 'changed', 'verb',
'postopts', 'plink', 'resource-id', 'event-id', 'attach', 'inform', 'postopts', 'plink', 'resource-id', 'event-id', 'attach', 'inform',
@ -669,7 +669,7 @@ class Item
$fields = []; $fields = [];
$fields['item'] = ['id', 'uid', 'parent', 'uri', 'parent-uri', 'thr-parent', $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', 'contact-id', 'owner-id', 'author-id', 'type', 'wall', 'gravity', 'extid',
'created', 'edited', 'commented', 'received', 'changed', 'psid', 'created', 'edited', 'commented', 'received', 'changed', 'psid',
'resource-id', 'event-id', 'attach', 'post-type', 'file', 'resource-id', 'event-id', 'attach', 'post-type', 'file',

View file

@ -33,7 +33,7 @@ class Verb
* @return integer verb id * @return integer verb id
* @throws \Exception * @throws \Exception
*/ */
public static function getID($verb) public static function getID(string $verb)
{ {
if (empty($verb)) { if (empty($verb)) {
return 0; return 0;
@ -48,4 +48,24 @@ class Verb
return DBA::lastInsertId(); 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'];
}
} }