public function countWithTag($tagIdSlug, $data = null, $includeDeleted = false)
    {
        $oDb = Factory::service('Database');

        //  Join the $this->tableTag table so we can WHERE on it.
        $oDb->join(
            $this->tableTag . ' ' . $this->tableTagPrefix,
            $this->tableTagPrefix . '.post_id = ' . $this->tableAlias . '.id'
        );
        $oDb->join(
            NAILS_DB_PREFIX . 'blog_tag bt',
            'bt.id = ' . $this->tableTagPrefix . '.tag_id'
        );

        //  Set the where
        if (is_null($data)) {

            $data = ['where' => []];
        }

        if (is_numeric($tagIdSlug)) {

            $data['where'][] = ['column' => 'bt.id', 'value' => (int) $tagIdSlug];

        } else {

            $data['where'][] = ['column' => 'bt.slug', 'value' => $tagIdSlug];
        }

        return $this->countAll($data, $includeDeleted);
    }
public function countWithTag($tagIdSlug, $data = null, $includeDeleted = false)
    {
        $oDb = Factory::service('Database');

        //  Join the $this->tableTag table so we can WHERE on it.
        $oDb->join(
            $this->tableTag . ' ' . $this->tableTagPrefix,
            $this->tableTagPrefix . '.post_id = ' . $this->tableAlias . '.id'
        );
        $oDb->join(
            NAILS_DB_PREFIX . 'blog_tag bt',
            'bt.id = ' . $this->tableTagPrefix . '.tag_id'
        );

        //  Set the where
        if (is_null($data)) {

            $data = ['where' => []];
        }

        if (is_numeric($tagIdSlug)) {

            $data['where'][] = ['column' => 'bt.id', 'value' => (int) $tagIdSlug];

        } else {

            $data['where'][] = ['column' => 'bt.slug', 'value' => $tagIdSlug];
        }

        return $this->countAll($data, $includeDeleted);
    }
public function countWithTag ( $ tagIdSlug , $ data = null , $ includeDeleted = false ) { $ oDb = Factory :: service ( 'Database' ) ; //  Join the $this->tableTag table so we can WHERE on it. $ oDb -> join ( $ this -> tableTag . ' ' . $ this -> tableTagPrefix , $ this -> tableTagPrefix . '.post_id = ' . $ this -> tableAlias . '.id' ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'blog_tag bt' , 'bt.id = ' . $ this -> tableTagPrefix . '.tag_id' ) ; //  Set the where if ( is_null ( $ data ) ) { $ data = [ 'where' => [ ] ] ; } if ( is_numeric ( $ tagIdSlug ) ) { $ data [ 'where' ] [ ] = [ 'column' => 'bt.id' , 'value' => ( int ) $ tagIdSlug ] ; } else { $ data [ 'where' ] [ ] = [ 'column' => 'bt.slug' , 'value' => $ tagIdSlug ] ; } return $ this -> countAll ( $ data , $ includeDeleted ) ; }
Count the number of posts in a particular tag

@param  mixed   $tagIdSlug      The tag's ID or slug
@param  array   $data           Data to pass to getCountCommon()
@param  boolean $includeDeleted Whether to include deleted posts in the result

@return int
Count the number of posts in a particular tag