backend/models/search/UserServerLicensesSearch.php
/**
     * Creates data provider instance with search query applied
     *
     * @param integer $user_id
     * @param array $params
     *
     * @return ActiveDataProvider
     */
Creates data provider instance with search query applied
@param integer $user_id
@param array $params


Creates data provider instance with search query applied @param integer $user_id @param array $params
public function search($user_id, $params)
    {
        $query = self::find()
            ->alias('t1')
            ->select('t1.*, t2.user_email as lic_srv_colleague_email, t3.node_name')
            ->leftJoin('{{%users}} as t2', 't1.lic_srv_colleague_user_id = t2.user_id')
            ->leftJoin('{{%user_node}} as t3', 't1.lic_srv_node_id = t3.node_id')
            ->where(['lic_srv_owner_user_id' => $user_id]);
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort'=> [
                'params' => array_merge($_GET, ['tab' => 'licenses-info', '#' => 'licenses-info']),
                'sortParam' => 'sort-usl',
                'defaultOrder' => ['lic_srv_id'=>SORT_ASC],
                'attributes' => [
                    'lic_srv_id',
                    'lic_srv_colleague_email',
                ]
            ],
            'pagination' => false,
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere(['like', 'lic_srv_colleague_email', $this->lic_srv_colleague_email]);
        return $dataProvider;
    }
public function search ( $ user_id , $ params ) { $ query = self :: find ( ) -> alias ( 't1' ) -> select ( 't1.*, t2.user_email as lic_srv_colleague_email, t3.node_name' ) -> leftJoin ( '{{%users}} as t2' , 't1.lic_srv_colleague_user_id = t2.user_id' ) -> leftJoin ( '{{%user_node}} as t3' , 't1.lic_srv_node_id = t3.node_id' ) -> where ( [ 'lic_srv_owner_user_id' => $ user_id ] ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , 'sort' => [ 'params' => array_merge ( $ _GET , [ 'tab' => 'licenses-info' , '#' => 'licenses-info' ] ) , 'sortParam' => 'sort-usl' , 'defaultOrder' => [ 'lic_srv_id' => SORT_ASC ] , 'attributes' => [ 'lic_srv_id' , 'lic_srv_colleague_email' , ] ] , 'pagination' => false , ] ) ; $ this -> load ( $ params ) ; if ( ! $ this -> validate ( ) ) { return $ dataProvider ; } $ query -> andFilterWhere ( [ 'like' , 'lic_srv_colleague_email' , $ this -> lic_srv_colleague_email ] ) ; return $ dataProvider ; }
Creates data provider instance with search query applied
 @param integer $user_id
 @param array $params
Creates data provider instance with search query applied @param integer $user_id @param array $params
/*
            'pagination' => [
                'params' => array_merge($_GET, ['tab' => 'licenses-info', '#' => 'licenses-info']),
                'pageParam' => 'p-lic-inf',
                'pageSizeParam' => 'per-p-lic-inf',
                'pageSize' => 100,
                //'route' => \yii\helpers\Url::current(['tab' => 'licenses-info', 'id' => $user_id])
            ],
            */ // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1');