]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Post/Question.php
Merge pull request #11526 from annando/ap-endpoint-cache
[friendica.git] / src / Model / Post / Question.php
index 949ff2ec5e4d7ab87d6d40f306cb061b118c914b..db0d755b7fe47b1402a3b38a27ab3224b8b26331 100644 (file)
@@ -21,8 +21,7 @@
 
 namespace Friendica\Model\Post;
 
-use \BadMethodCallException;
-use Friendica\Database\Database;
+use BadMethodCallException;
 use Friendica\Database\DBA;
 use Friendica\Database\DBStructure;
 
@@ -54,4 +53,14 @@ class Question
 
                return DBA::update('post-question', $fields, ['uri-id' => $uri_id], $insert_if_missing ? true : []);
        }
+
+       /**
+        * @param integer $id     Question ID
+        * @param array   $fields Array of selected fields, empty for all
+        * @return array|boolean  Question record if it exists, false otherwise
+        */
+       public static function getById($id, $fields = [])
+       {
+               return DBA::selectFirst('post-question', $fields, ['id' => $id]);
+       }
 }