/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CsObjectPropertyValues::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, 'object_property_id' => $this->object_property_id, 'property_value_id' => $this->property_value_id, 'object_id' => $this->object_id, 'selected_value' => $this->selected_value]); $query->andFilterWhere(['like', 'value_type', $this->value_type]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getObjectPropertyValues() { return $this->hasMany(CsObjectPropertyValues::className(), ['object_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getObjectPropertyValue() { return $this->hasOne(CsObjectPropertyValues::className(), ['id' => 'object_property_value_id']); }
/** * Displays a single CsObjectProperties model. * @param string $id * @return mixed */ public function actionView($id) { return $this->render('view', ['model' => $this->findModel($id), 'propertyValues' => new ActiveDataProvider(['query' => \common\models\CsObjectPropertyValues::find()->where(['object_property_id' => $id])])]); }
/** * Finds the CsObjectPropertyValues model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return CsObjectPropertyValues the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CsObjectPropertyValues::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }