]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Contact/Group.php
Merge pull request #11677 from Quix0r/rewrites/type-hints-doc-001
[friendica.git] / src / Model / Contact / Group.php
index 5bf1dce507017ba9998fc863a974185a537c77ab..0f0b4965cdf96ac3511be81c3afdbb77b96ee9f4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -22,6 +22,7 @@
 namespace Friendica\Model\Contact;
 
 use Friendica\Database\DBA;
+use Friendica\Model\Contact;
 
 /**
  * This class provides information about contact groups based on the "group_member" table.
@@ -35,7 +36,7 @@ class Group
         * @return array
         * @throws \Exception
         */
-       public static function getById(int $gid)
+       public static function getById(int $gid): array
        {
                $return = [];
 
@@ -75,20 +76,9 @@ class Group
         */
        public static function listUngrouped(int $uid)
        {
-               return q("SELECT *
-                          FROM `contact`
-                          WHERE `uid` = %d
-                          AND NOT `self`
-                          AND NOT `deleted`
-                          AND NOT `blocked`
-                          AND NOT `pending`
-                          AND NOT `failed`
-                          AND `id` NOT IN (
-                               SELECT DISTINCT(`contact-id`)
-                               FROM `group_member`
-                               INNER JOIN `group` ON `group`.`id` = `group_member`.`gid`
-                               WHERE `group`.`uid` = %d
-                          )", intval($uid), intval($uid));
+               return Contact::selectToArray([], ["`uid` = ? AND NOT `self` AND NOT `deleted` AND NOT `blocked` AND NOT `pending` AND NOT `failed`
+                       AND `id` NOT IN (SELECT DISTINCT(`contact-id`) FROM `group_member` INNER JOIN `group` ON `group`.`id` = `group_member`.`gid`
+                               WHERE `group`.`uid` = ?)", $uid, $uid]);
        }
 
        /**