protected function getCountCommon(array $aData = [])
    {
        //  Join user tables
        $oDb = Factory::service('Database');
        $oDb->join(NAILS_DB_PREFIX . 'user u', 'u.id = ' . $this->getTableAlias() . '.user_id', 'LEFT');
        $oDb->join(NAILS_DB_PREFIX . 'user_email ue', 'ue.user_id = ' . $this->getTableAlias() . '.user_id AND ue.is_primary = 1', 'LEFT');

        //  Searching?
        if (!empty($aData['keywords'])) {

            if (empty($aData['or_like'])) {
                $aData['or_like'] = [];
            }

            $toSlug = strtolower(str_replace(' ', '_', $aData['keywords']));

            $aData['or_like'][] = [
                'column' => $this->getTableAlias() . '.type',
                'value'  => $toSlug,
            ];
            $aData['or_like'][] = [
                'column' => 'ue.email',
                'value'  => $aData['keywords'],
            ];
        }

        parent::getCountCommon($aData);
    }
protected function getCountCommon(array $aData = [])
    {
        //  Join user tables
        $oDb = Factory::service('Database');
        $oDb->join(NAILS_DB_PREFIX . 'user u', 'u.id = ' . $this->getTableAlias() . '.user_id', 'LEFT');
        $oDb->join(NAILS_DB_PREFIX . 'user_email ue', 'ue.user_id = ' . $this->getTableAlias() . '.user_id AND ue.is_primary = 1', 'LEFT');

        //  Searching?
        if (!empty($aData['keywords'])) {

            if (empty($aData['or_like'])) {
                $aData['or_like'] = [];
            }

            $toSlug = strtolower(str_replace(' ', '_', $aData['keywords']));

            $aData['or_like'][] = [
                'column' => $this->getTableAlias() . '.type',
                'value'  => $toSlug,
            ];
            $aData['or_like'][] = [
                'column' => 'ue.email',
                'value'  => $aData['keywords'],
            ];
        }

        parent::getCountCommon($aData);
    }
protected function getCountCommon ( array $ aData = [ ] ) { //  Join user tables $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'user u' , 'u.id = ' . $ this -> getTableAlias ( ) . '.user_id' , 'LEFT' ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'user_email ue' , 'ue.user_id = ' . $ this -> getTableAlias ( ) . '.user_id AND ue.is_primary = 1' , 'LEFT' ) ; //  Searching? if ( ! empty ( $ aData [ 'keywords' ] ) ) { if ( empty ( $ aData [ 'or_like' ] ) ) { $ aData [ 'or_like' ] = [ ] ; } $ toSlug = strtolower ( str_replace ( ' ' , '_' , $ aData [ 'keywords' ] ) ) ; $ aData [ 'or_like' ] [ ] = [ 'column' => $ this -> getTableAlias ( ) . '.type' , 'value' => $ toSlug , ] ; $ aData [ 'or_like' ] [ ] = [ 'column' => 'ue.email' , 'value' => $ aData [ 'keywords' ] , ] ; } parent :: getCountCommon ( $ aData ) ; }
Applies common conditionals

@param array $aData Data passed from the calling method

@throws \Nails\Common\Exception\FactoryException
Applies common conditionals