Fixed most used tag retrieving

This commit is contained in:
Marcin Kurczewski 2014-05-11 21:57:41 +02:00
parent 9cc8d03376
commit 72821157dd

View file

@ -69,7 +69,8 @@ class TagSearchService extends AbstractSearchService
{
$stmt = (new Sql\SelectStatement)
->setTable('post_tag')
->addColumn('tag_id')
->addInnerJoin('tag', new Sql\EqualsFunctor('post_tag.tag_id', 'tag.id'))
->addColumn('tag.*')
->addColumn(new Sql\AliasFunctor(new Sql\CountFunctor('post_tag.post_id'), 'post_count'))
->setGroupBy('post_tag.tag_id')
->setOrderBy('post_count', Sql\SelectStatement::ORDER_DESC)