/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = CsIndustryProperties::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, 'industry_id' => $this->industry_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;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIndustryProperty()
 {
     return $this->hasOne(CsIndustryProperties::className(), ['id' => 'industry_property_id']);
 }
 /**
  * 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])])]);
 }
 /**
  * Finds the CsIndustryProperties model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CsIndustryProperties the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = CsIndustryProperties::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemple #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIndustryProperties()
 {
     return $this->hasMany(CsIndustryProperties::className(), ['property_id' => 'id']);
 }