/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CsProductProperties::find(); // add conditions that should always apply here $dataProvider = new ActiveDataProvider(['query' => $query]); $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; } // grid filtering conditions $query->andFilterWhere(['id' => $this->id, 'product_id' => $this->product_id, 'object_property_id' => $this->object_property_id, 'property_unit_id' => $this->property_unit_id, 'property_unit_imperial_id' => $this->property_unit_imperial_id, 'input_type' => $this->input_type, 'value_min' => $this->value_min, 'value_max' => $this->value_max, 'step' => $this->step, 'display_order' => $this->display_order, 'multiple_values' => $this->multiple_values, 'specific_values' => $this->specific_values, 'read_only' => $this->read_only, 'required' => $this->required]); $query->andFilterWhere(['like', 'property_class', $this->property_class])->andFilterWhere(['like', 'value_default', $this->value_default])->andFilterWhere(['like', 'pattern', $this->pattern])->andFilterWhere(['like', 'description', $this->description]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getProductProperties() { return $this->hasMany(CsProductProperties::className(), ['product_id' => 'id']); }
/** * Finds the CsProductProperties model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return CsProductProperties the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CsProductProperties::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getProductProperty() { return $this->hasOne(CsProductProperties::className(), ['id' => 'product_property_id']); }