开发者

Using sfDoctrineActAsTaggablePlugin, how to get the list of tags + the number of contents they tag?

PluginTagTable::getAllTagNameWithCount() gets me the list of tags, but I need to add a condition on the Contents the tags are tagged to.

How do I get the list of tags + the number of c开发者_JAVA技巧ontents, where content.state_id = 3?


Found the answer in apostrophe plugin :

$q = Doctrine_Query::create()->from('Tagging tg, tg.Tag t, Content c');
$q->andWhere('c.id = tg.taggable_id and c.state_id = ?', 3);

$this->tagsInOrder = PluginTagTable::getAllTagNameWithCount($q,Array('model' => 'Content', 'sort_by_popularity' => true));
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜