From: Evan Prodromou Date: Mon, 1 Aug 2011 19:18:29 +0000 (-0400) Subject: use multiGet() for a profile's groups X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=a3ef80941e1c5bac21e591a5c0b9c257e216d542;p=quix0rs-gnu-social.git use multiGet() for a profile's groups --- diff --git a/classes/Profile.php b/classes/Profile.php index f635ee470d..5eebd64a0d 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -273,16 +273,7 @@ class Profile extends Memcached_DataObject self::cacheSet($keypart, implode(',', $ids)); } - $groups = array(); - - foreach ($ids as $id) { - $group = User_group::staticGet('id', $id); - if (!empty($group)) { - $groups[] = $group; - } - } - - return new ArrayWrapper($groups); + return User_group::multiGet('id', $ids); } function isTagged($peopletag) diff --git a/classes/User_group.php b/classes/User_group.php index 6168f219b9..38cc5603db 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -33,6 +33,11 @@ class User_group extends Memcached_DataObject function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('User_group',$k,$v); } + + function multiGet($keyCol, $keyVals, $skipNulls=true) + { + return parent::multiGet('User_group', $keyCol, $keyVals, $skipNulls); + } /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE