public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c = parent::prepareQueryBeforeCount($c);
     $where = array('class_key' => 'SocietyBlog');
     $c->where($where);
     return $c;
 }
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c = parent::prepareQueryBeforeCount($c);
     if ($blog = (int) $this->getProperty('blog')) {
         /*
             Получаем топики согласно связке топик-блог
         */
         $c->innerJoin('SocietyBlogTopic', 'TopicBlogs', "TopicBlogs.blogid IN ({$blog}) AND TopicBlogs.topicid={$this->classKey}.id");
     }
     $c->where(array('class_key' => 'SocietyTopic'));
     return $c;
 }