Merge pull request #4049 from annando/bugfix-pr-4046

Bugfix to PR 4046: Repaired query
This commit is contained in:
Hypolite Petovan 2017-12-10 16:52:15 -05:00 committed by GitHub
commit 8d57c7c94a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,21 +62,13 @@ class Group extends BaseObject
*/
private static function getByContactIdForUserId($uid, $cid)
{
$stmt = dba::p('SELECT `id`
FROM `group`
INNER JOIN `group_member`
ON `group_member`.`gid` = `group`.`id`
WHERE `group`.`uid` = ?
AND `group_member`.`contact-id` = ?',
$uid,
$cid
);
$condition = ['uid' => $uid, 'contact-id' => $cid];
$stmt = dba::select('group_member', ['gid'], $condition);
$return = [];
if (DBM::is_result($stmt)) {
while($group = dba::fetch($stmt)) {
$return[] = $group['id'];
}
while ($group = dba::fetch($stmt)) {
$return[] = $group['gid'];
}
return $return;