<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
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.
*/
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]);
}
/**