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));
精彩评论