Merge pull request #4049 from annando/bugfix-pr-4046
Bugfix to PR 4046: Repaired query
This commit is contained in:
commit
8d57c7c94a
1 changed files with 5 additions and 13 deletions
|
@ -62,21 +62,13 @@ class Group extends BaseObject
|
||||||
*/
|
*/
|
||||||
private static function getByContactIdForUserId($uid, $cid)
|
private static function getByContactIdForUserId($uid, $cid)
|
||||||
{
|
{
|
||||||
$stmt = dba::p('SELECT `id`
|
$condition = ['uid' => $uid, 'contact-id' => $cid];
|
||||||
FROM `group`
|
$stmt = dba::select('group_member', ['gid'], $condition);
|
||||||
INNER JOIN `group_member`
|
|
||||||
ON `group_member`.`gid` = `group`.`id`
|
|
||||||
WHERE `group`.`uid` = ?
|
|
||||||
AND `group_member`.`contact-id` = ?',
|
|
||||||
$uid,
|
|
||||||
$cid
|
|
||||||
);
|
|
||||||
|
|
||||||
$return = [];
|
$return = [];
|
||||||
if (DBM::is_result($stmt)) {
|
|
||||||
while($group = dba::fetch($stmt)) {
|
while ($group = dba::fetch($stmt)) {
|
||||||
$return[] = $group['id'];
|
$return[] = $group['gid'];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
|
|
Loading…
Reference in a new issue