basic/_protected/models/ContractsSearch2.php
/**
     * Creates data provider instance with search query applied
     *
     * @param array $params
     *
     * @return ActiveDataProvider
     */
Creates data provider instance with search query applied
@param array $params


Creates data provider instance with search query applied @param array $params
public function search($params)
    {
        $query = Contracts::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->joinWith('firstCompany');
        $query->joinWith('secondCompany');
        $query->andFilterWhere([
            'id' => $this->id,
            'contract_number' => $this->contract_number,
            'contract_date' => $this->contract_date,
            'status' => $this->status,
        ]);
        $query->andFilterWhere(['like','company.name', $this->first_company_id]);
        $query->andFilterWhere(['like','company.name', $this->second_company_id]);
        return $dataProvider;
    }
public function search ( $ params ) { $ query = Contracts :: find ( ) ; $ dataProvider = new ActiveDataProvider ( [ 'query' => $ query , ] ) ; $ this -> load ( $ params ) ; if ( ! $ this -> validate ( ) ) { return $ dataProvider ; } $ query -> joinWith ( 'firstCompany' ) ; $ query -> joinWith ( 'secondCompany' ) ; $ query -> andFilterWhere ( [ 'id' => $ this -> id , 'contract_number' => $ this -> contract_number , 'contract_date' => $ this -> contract_date , 'status' => $ this -> status , ] ) ; $ query -> andFilterWhere ( [ 'like' , 'company.name' , $ this -> first_company_id ] ) ; $ query -> andFilterWhere ( [ 'like' , 'company.name' , $ this -> second_company_id ] ) ; return $ dataProvider ; }
Creates data provider instance with search query applied
 @param array $params
Creates data provider instance with search query applied @param array $params
// add conditions that should always apply here //        $query->andFilterWhere(['status' => 1]); // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); // grid filtering conditions //            'first_company_id' => $this->first_company_id, //            'second_company_id' => $this->second_company_id,