rewrite Profile_tag::getTagsArray() so it doesn't use joinAdd()

This commit is contained in:
Evan Prodromou 2011-09-27 09:42:34 -04:00
parent 8c710ad2c1
commit ce044c40fb

View File

@ -99,23 +99,26 @@ class Profile_tag extends Managed_DataObject
static function getTagsArray($tagger, $tagged, $auth_user_id=null) static function getTagsArray($tagger, $tagged, $auth_user_id=null)
{ {
$ptag = new Profile_tag(); $ptag = new Profile_tag();
$ptag->tagger = $tagger;
$ptag->tagged = $tagged;
if ($tagger != $auth_user_id) { $qry = sprint('select profile_tag.tag '.
$list = new Profile_list(); 'from profile_tag join profile_list '.
$list->private = false; ' on (profile_tag.tagger = profile_list.tagger ' .
$ptag->joinAdd($list); ' and profile_tag.tag = profile_list.tag) ' .
$ptag->selectAdd(); 'where profile_tag.tagger = %d ' .
$ptag->selectAdd('profile_tag.tag'); 'and profile_tag.tagged = %d ',
$tagger, $tagged);
if ($auth_user_id != $tagger) {
$qry .= 'and profile_list.private = 0';
} }
$tags = array(); $tags = array();
$ptag->find();
$ptag->query($sql);
while ($ptag->fetch()) { while ($ptag->fetch()) {
$tags[] = $ptag->tag; $tags[] = $ptag->tag;
} }
$ptag->free();
return $tags; return $tags;
} }