/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CsActionProperties::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, 'action_id' => $this->action_id, 'property_id' => $this->property_id, 'value_min' => $this->value_min, 'value_max' => $this->value_max, 'step' => $this->step, 'display_order' => $this->display_order, 'multiple_values' => $this->multiple_values, 'read_only' => $this->read_only, 'required' => $this->required]); $query->andFilterWhere(['like', 'value_default', $this->value_default])->andFilterWhere(['like', 'pattern', $this->pattern]); return $dataProvider; }
/** * Displays a single CsProperties model. * @param integer $id * @return mixed */ public function actionView($id) { return $this->render('view', ['model' => $this->findModel($id), 'propertyValues' => new ActiveDataProvider(['query' => CsPropertyValues::find()->filterWhere(['property_id' => $id])]), 'industryProperties' => new ActiveDataProvider(['query' => CsIndustryProperties::find()->filterWhere(['property_id' => $id])]), 'actionProperties' => new ActiveDataProvider(['query' => CsActionProperties::find()->filterWhere(['property_id' => $id])]), 'objectProperties' => new ActiveDataProvider(['query' => CsObjectProperties::find()->filterWhere(['property_id' => $id])])]); }
/** * @return \yii\db\ActiveQuery */ public function getActionProperty() { return $this->hasOne(CsActionProperties::className(), ['id' => 'action_property_id']); }
/** * @return \yii\db\ActiveQuery */ public function getActionProperties() { return $this->hasMany(CsActionProperties::className(), ['action_id' => 'id']); }
/** * Finds the CsActionProperties model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CsActionProperties the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CsActionProperties::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }