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

        //  Join the $this->tableCat table so we can WHERE on it.
        $oDb->join(
            $this->tableCat . ' ' . $this->tableCatPrefix,
            $this->tableCatPrefix . '.post_id = ' . $this->tableAlias . '.id'
        );
        $oDb->join(
            NAILS_DB_PREFIX . 'blog_category bc',
            'bc.id = ' . $this->tableCatPrefix . '.category_id'
        );

        //  Set the where
        if (is_null($data)) {
            $data = ['where' => []];
        }

        if (is_numeric($categoryIdSlug)) {
            $data['where'][] = ['column' => 'bc.id', 'value' => (int) $categoryIdSlug];
        } else {
            $data['where'][] = ['column' => 'bc.slug', 'value' => $categoryIdSlug];
        }

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

        //  Join the $this->tableCat table so we can WHERE on it.
        $oDb->join(
            $this->tableCat . ' ' . $this->tableCatPrefix,
            $this->tableCatPrefix . '.post_id = ' . $this->tableAlias . '.id'
        );
        $oDb->join(
            NAILS_DB_PREFIX . 'blog_category bc',
            'bc.id = ' . $this->tableCatPrefix . '.category_id'
        );

        //  Set the where
        if (is_null($data)) {
            $data = ['where' => []];
        }

        if (is_numeric($categoryIdSlug)) {
            $data['where'][] = ['column' => 'bc.id', 'value' => (int) $categoryIdSlug];
        } else {
            $data['where'][] = ['column' => 'bc.slug', 'value' => $categoryIdSlug];
        }

        return $this->countAll($data, $includeDeleted);
    }
public function countWithCategory ( $ categoryIdSlug , $ data = null , $ includeDeleted = false ) { $ oDb = Factory :: service ( 'Database' ) ; //  Join the $this->tableCat table so we can WHERE on it. $ oDb -> join ( $ this -> tableCat . ' ' . $ this -> tableCatPrefix , $ this -> tableCatPrefix . '.post_id = ' . $ this -> tableAlias . '.id' ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'blog_category bc' , 'bc.id = ' . $ this -> tableCatPrefix . '.category_id' ) ; //  Set the where if ( is_null ( $ data ) ) { $ data = [ 'where' => [ ] ] ; } if ( is_numeric ( $ categoryIdSlug ) ) { $ data [ 'where' ] [ ] = [ 'column' => 'bc.id' , 'value' => ( int ) $ categoryIdSlug ] ; } else { $ data [ 'where' ] [ ] = [ 'column' => 'bc.slug' , 'value' => $ categoryIdSlug ] ; } return $ this -> countAll ( $ data , $ includeDeleted ) ; }
Count the number of posts in a particular category

@param  mixed   $categoryIdSlug The category'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 category