/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $this->load($params); $query = NutsLocation::find(); $query->where(['country_id' => $this->country_id, 'postcode' => $this->postcode]); $this->pageSize = 1; $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => $this->pagination ? ['pageSize' => $this->pageSize] : FALSE, 'sort' => ['attributes' => ['postcode']]]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getNutsLocations() { return $this->hasMany(NutsLocation::className(), ['nuts_code_id' => 'id']); }