From: Michael J. Rubinsky Date: Sat, 3 Jan 2009 01:57:40 +0000 (-0500) Subject: Start to standardize on returning id => name hashes from the get* methods X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=cb7ae298100eb8e7bb0c7a49832d9b4773fd067a;p=horde.git Start to standardize on returning id => name hashes from the get* methods --- diff --git a/content/lib/Tagger.php b/content/lib/Tagger.php index e1bbd3b1c..7dea6f469 100644 --- a/content/lib/Tagger.php +++ b/content/lib/Tagger.php @@ -322,7 +322,7 @@ class Content_Tagger $args['objectId'] = array_pop($this->_objectManager->ensureObject($args['objectId'])); $radius = isset($args['radius']) ? (int)$args['radius'] : $this->_defaultRadius; $inner = $this->_db->addLimitOffset('SELECT tag_id FROM ' . $this->_t('tagged') . ' WHERE object_id = ' . (int)$objectId, array('limit' => $radius)); - $sql = $this->_db->addLimitOffset('SELECT tagged2.object_id FROM (' . $inner . ') AS t1 INNER JOIN ' . $this->_tagged . ' AS tagged2 ON t1.tag_id = t2.tag_id WHERE t2.object_id != ' . (int)$objectId . ' GROUP BY t2.object_id', array('limit' => $radius)); + $sql = $this->_db->addLimitOffset('SELECT tagged2.object_id as object_id, object_name FROM (' . $inner . ') AS t1 INNER JOIN ' . $this->_tagged . ' AS tagged2 ON t1.tag_id = t2.tag_id INNER JOIN ' . $this->_t('objects') . ' AS objects ON objects.object_id =tagged.object_id WHERE t2.object_id != ' . (int)$objectId . ' GROUP BY t2.object_id', array('limit' => $radius)); } elseif (isset($args['tagId'])) { $tags = is_array($args['tagId']) ? array_values($args['tagId']) : array($args['tagId']); $count = count($tags); @@ -333,7 +333,7 @@ class Content_Tagger $notTags = isset($args['notTagId']) ? (is_array($args['notTagId']) ? array_values($args['notTagId']) : array($args['notTagId'])) : array(); $notCount = count($notTags); - $sql = 'SELECT DISTINCT tagged.object_id FROM ' . $this->_t('tagged') . ' AS tagged INNER JOIN ' . $this->_t('objects') . ' AS objects ON objects.object_id =tagged.object_id'; + $sql = 'SELECT DISTINCT tagged.object_id as object_id, object_name FROM ' . $this->_t('tagged') . ' AS tagged INNER JOIN ' . $this->_t('objects') . ' AS objects ON objects.object_id =tagged.object_id'; if (!empty($args['typeId'])) { $args['typeId'] = $this->_typeManager->ensureTypes($args['typeId']); @@ -376,7 +376,7 @@ class Content_Tagger $sql = $this->_db->addLimitOffset($sql, array('limit' => $args['limit'], 'offset' => isset($args['offset']) ? $args['offset'] : 0)); } - return $this->_db->selectValues($sql); + return $this->_db->selectAssoc($sql); } /**