/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function searchparent($params) { $query = Kategoricus::find()->where('CUST_KTG_PARENT <> 0')->orderBy('CUST_KTG_PARENT'); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 20]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['CUST_KTG_NM' => $this->CUST_KTG_NM, 'CUST_KTG_PARENT' => $this->CUST_KTG_PARENT]); $query->andFilterWhere(['like', 'CUST_KTG_NM', $this->CUST_KTG_NM])->andFilterWhere(['like', 'CUST_KTG', $this->CUST_KTG])->andFilterWhere(['like', 'CUST_KTG_PARENT', $this->CUST_KTG_PARENT]); return $dataProvider; }
protected function findModel($id) { if (($model = Kategoricus::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function getCustype() { return $this->hasOne(Kategoricus::className(), ['CUST_KTG' => 'CUST_TYPE']); }