protected function getCountCommon($data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select(
            [
                $this->tableAlias . '.id',
                $this->tableAlias . '.blog_id',
                'b.label blog_label',
                $this->tableAlias . '.slug',
                $this->tableAlias . '.title',
                $this->tableAlias . '.image_id',
                $this->tableAlias . '.excerpt',
                $this->tableAlias . '.seo_title',
                $this->tableAlias . '.seo_description',
                $this->tableAlias . '.seo_keywords',
                $this->tableAlias . '.is_published',
                $this->tableAlias . '.is_deleted',
                $this->tableAlias . '.created',
                $this->tableAlias . '.created_by',
                $this->tableAlias . '.modified',
                $this->tableAlias . '.modified_by',
                $this->tableAlias . '.published',
                $this->tableAlias . '.comments_enabled',
                $this->tableAlias . '.comments_expire',
                $this->tableAlias . '.type',
                $this->tableAlias . '.audio_url',
                $this->tableAlias . '.video_url',
                'u.first_name',
                'u.last_name',
                'ue.email',
                'u.profile_img',
                'u.gender',
            ]
        );

        $oDb->join(NAILS_DB_PREFIX . 'blog b', $this->tableAlias . '.blog_id = b.id', 'LEFT');
        $oDb->join(NAILS_DB_PREFIX . 'user u', $this->tableAlias . '.modified_by = u.id', 'LEFT');
        $oDb->join(NAILS_DB_PREFIX . 'user_email ue', 'ue.user_id = u.id AND ue.is_primary = 1', 'LEFT');

        // --------------------------------------------------------------------------

        if (!empty($data['include_body'])) {
            $oDb->select($this->tableAlias . '.body');
        }

        // --------------------------------------------------------------------------

        if (!empty($data['keywords'])) {

            if (empty($data['or_like'])) {

                $data['or_like'] = [];
            }

            $data['or_like'][] = [
                'column' => $this->tableAlias . '.title',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.excerpt',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.body',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.seo_description',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.seo_keywords',
                'value'  => $data['keywords'],
            ];
        }

        // --------------------------------------------------------------------------

        parent::getCountCommon($data);
    }
protected function getCountCommon($data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select(
            [
                $this->tableAlias . '.id',
                $this->tableAlias . '.blog_id',
                'b.label blog_label',
                $this->tableAlias . '.slug',
                $this->tableAlias . '.title',
                $this->tableAlias . '.image_id',
                $this->tableAlias . '.excerpt',
                $this->tableAlias . '.seo_title',
                $this->tableAlias . '.seo_description',
                $this->tableAlias . '.seo_keywords',
                $this->tableAlias . '.is_published',
                $this->tableAlias . '.is_deleted',
                $this->tableAlias . '.created',
                $this->tableAlias . '.created_by',
                $this->tableAlias . '.modified',
                $this->tableAlias . '.modified_by',
                $this->tableAlias . '.published',
                $this->tableAlias . '.comments_enabled',
                $this->tableAlias . '.comments_expire',
                $this->tableAlias . '.type',
                $this->tableAlias . '.audio_url',
                $this->tableAlias . '.video_url',
                'u.first_name',
                'u.last_name',
                'ue.email',
                'u.profile_img',
                'u.gender',
            ]
        );

        $oDb->join(NAILS_DB_PREFIX . 'blog b', $this->tableAlias . '.blog_id = b.id', 'LEFT');
        $oDb->join(NAILS_DB_PREFIX . 'user u', $this->tableAlias . '.modified_by = u.id', 'LEFT');
        $oDb->join(NAILS_DB_PREFIX . 'user_email ue', 'ue.user_id = u.id AND ue.is_primary = 1', 'LEFT');

        // --------------------------------------------------------------------------

        if (!empty($data['include_body'])) {
            $oDb->select($this->tableAlias . '.body');
        }

        // --------------------------------------------------------------------------

        if (!empty($data['keywords'])) {

            if (empty($data['or_like'])) {

                $data['or_like'] = [];
            }

            $data['or_like'][] = [
                'column' => $this->tableAlias . '.title',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.excerpt',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.body',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.seo_description',
                'value'  => $data['keywords'],
            ];
            $data['or_like'][] = [
                'column' => $this->tableAlias . '.seo_keywords',
                'value'  => $data['keywords'],
            ];
        }

        // --------------------------------------------------------------------------

        parent::getCountCommon($data);
    }
protected function getCountCommon ( $ data = [ ] ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> select ( [ $ this -> tableAlias . '.id' , $ this -> tableAlias . '.blog_id' , 'b.label blog_label' , $ this -> tableAlias . '.slug' , $ this -> tableAlias . '.title' , $ this -> tableAlias . '.image_id' , $ this -> tableAlias . '.excerpt' , $ this -> tableAlias . '.seo_title' , $ this -> tableAlias . '.seo_description' , $ this -> tableAlias . '.seo_keywords' , $ this -> tableAlias . '.is_published' , $ this -> tableAlias . '.is_deleted' , $ this -> tableAlias . '.created' , $ this -> tableAlias . '.created_by' , $ this -> tableAlias . '.modified' , $ this -> tableAlias . '.modified_by' , $ this -> tableAlias . '.published' , $ this -> tableAlias . '.comments_enabled' , $ this -> tableAlias . '.comments_expire' , $ this -> tableAlias . '.type' , $ this -> tableAlias . '.audio_url' , $ this -> tableAlias . '.video_url' , 'u.first_name' , 'u.last_name' , 'ue.email' , 'u.profile_img' , 'u.gender' , ] ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'blog b' , $ this -> tableAlias . '.blog_id = b.id' , 'LEFT' ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'user u' , $ this -> tableAlias . '.modified_by = u.id' , 'LEFT' ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'user_email ue' , 'ue.user_id = u.id AND ue.is_primary = 1' , 'LEFT' ) ; // -------------------------------------------------------------------------- if ( ! empty ( $ data [ 'include_body' ] ) ) { $ oDb -> select ( $ this -> tableAlias . '.body' ) ; } // -------------------------------------------------------------------------- if ( ! empty ( $ data [ 'keywords' ] ) ) { if ( empty ( $ data [ 'or_like' ] ) ) { $ data [ 'or_like' ] = [ ] ; } $ data [ 'or_like' ] [ ] = [ 'column' => $ this -> tableAlias . '.title' , 'value' => $ data [ 'keywords' ] , ] ; $ data [ 'or_like' ] [ ] = [ 'column' => $ this -> tableAlias . '.excerpt' , 'value' => $ data [ 'keywords' ] , ] ; $ data [ 'or_like' ] [ ] = [ 'column' => $ this -> tableAlias . '.body' , 'value' => $ data [ 'keywords' ] , ] ; $ data [ 'or_like' ] [ ] = [ 'column' => $ this -> tableAlias . '.seo_description' , 'value' => $ data [ 'keywords' ] , ] ; $ data [ 'or_like' ] [ ] = [ 'column' => $ this -> tableAlias . '.seo_keywords' , 'value' => $ data [ 'keywords' ] , ] ; } // -------------------------------------------------------------------------- parent :: getCountCommon ( $ data ) ; }
Applies common conditionals

This method applies the conditionals which are common across the get_*()
methods and the count() method.

@param array $data Data passed from the calling method

@return void
Applies common conditionals