<commit_before><?php

// auto-loading
Yii::setPathOfAlias('PprsPerson', dirname(__FILE__));
Yii::import('PprsPerson.*');

class PprsPerson extends BasePprsPerson
{

    // Add your model-specific methods here. This file will not be overriden by gtc except you force it.
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

    public function init()
    {
        return parent::init();
    }

    public function getItemLabel()
    {
        return (string) $this->pprs_second_name . ' ' . $this->pprs_first_name;
    }

    public function behaviors()
    {
        return array_merge(
            parent::behaviors(),
            array()
        );
    }

    public function relations()
    {
        return array_merge(
            parent::relations(), array(
                'profile' => array(self::BELONGS_TO, 'Profile', 'pprs_id'),
            )
        );
    }    
    
    public function rules()
    {
        return array_merge(
            parent::rules()
        /* , array(
          array('column1, column2', 'rule1'),
          array('column3', 'rule2'),
          ) */
        );
    }

    public function scopes()
    {
//        return array(
//            'activeCompanyUsers'=>array(
//                'join'=>' inner join ccuc_user_company on ccuc_person_id = t.pprs_id',
//                'condition'=>'ccuc_ccmp_id = ' . Yii::app()->sysCompany->getActiveCompany(),
//            ),
//        );
        
    }       
    
    public function filterGroup($group)
    {
        $this->getDbCriteria()->mergeWith(array(
                'join'=>' inner join ppxt_person_x_type on ppxt_pprs_id = t.pprs_id',
                'condition'=>'ppxt_ptyp_id = ' . $group,
        ));
        return $this;
    }      
    
    public function search($criteria = null)
    {
        if (is_null($criteria)) {
            $criteria = new CDbCriteria;
        }
        return new CActiveDataProvider(get_class($this), array(
            'criteria' => $this->searchCriteria($criteria),
            'sort'=>array(
                'defaultOrder'=>'pprs_second_name,pprs_first_name',
            )

        ));
    }
    
    
    public function findAll($condition='',$params=array())
    {
        $criteria=$this->getCommandBuilder()->createCriteria($condition,$params);
        
        //criteria for trucks of SysCompanies
        if(Yii::app()->sysCompany->getActiveCompany()){
            $criteria->join .= ' inner join ccuc_user_company on ccuc_person_id = t.pprs_id ';
            $criteria->compare('ccuc_ccmp_id', Yii::app()->sysCompany->getActiveCompany());            
        }          
        return $this->query($criteria,true);
    }  
    
}
<commit_msg>For control access implemented beforeFind in model Pprsperson<commit_after><?php

// auto-loading
Yii::setPathOfAlias('PprsPerson', dirname(__FILE__));
Yii::import('PprsPerson.*');

class PprsPerson extends BasePprsPerson
{

    // Add your model-specific methods here. This file will not be overriden by gtc except you force it.
    public static function model($className = __CLASS__)
    {
        return parent::model($className);
    }

    public function init()
    {
        return parent::init();
    }

    public function getItemLabel()
    {
        return (string) $this->pprs_second_name . ' ' . $this->pprs_first_name;
    }

    public function behaviors()
    {
        return array_merge(
            parent::behaviors(),
            array()
        );
    }

    public function relations()
    {
        return array_merge(
            parent::relations(), array(
                'profile' => array(self::BELONGS_TO, 'Profile', 'pprs_id'),
            )
        );
    }    
    
    public function rules()
    {
        return array_merge(
            parent::rules()
        /* , array(
          array('column1, column2', 'rule1'),
          array('column3', 'rule2'),
          ) */
        );
    }

    public function scopes()
    {
       
    }       
    
    public function filterGroup($group)
    {
        $this->getDbCriteria()->mergeWith(array(
                'join'=>' inner join ppxt_person_x_type on ppxt_pprs_id = t.pprs_id',
                'condition'=>'ppxt_ptyp_id = ' . $group,
        ));
        return $this;
    }      
    
    public function search($criteria = null)
    {
        if (is_null($criteria)) {
            $criteria = new CDbCriteria;
        }
        return new CActiveDataProvider(get_class($this), array(
            'criteria' => $this->searchCriteria($criteria),
            'sort'=>array(
                'defaultOrder'=>'pprs_second_name,pprs_first_name',
            )

        ));
    }
    
   protected function beforeFind() {
        $criteria = new CDbCriteria;
        $criteria->join .= ' inner join ccuc_user_company  on ccuc_person_id = t.pprs_id ';
        $criteria->compare('ccuc_ccmp_id', Yii::app()->sysCompany->getActiveCompany());            

        $this->dbCriteria->mergeWith($criteria);
        parent::beforeFind();
    }        
}

{'fraction_non_alphanumeric': 0.1310086682427108, 'fraction_numerical': 0.001970055161544523, 'mean_word_length': 1.917816091954023, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 45, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2186621', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1483, 'n_words': 277}