コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * 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])])]);
 }