/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = CsObjectIssues::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_id' => $this->object_id, 'type' => $this->type]); $query->andFilterWhere(['like', 'issue', $this->issue]); return $dataProvider; }
/** * Displays a single CsObjects model. * @param string $id * @return mixed */ public function actionView($id) { $model = $this->findModel($id); $query = \common\models\CsObjectProperties::find()->where(['object_id' => $model->id]); if ($model->getPath($model)) { foreach ($model->getPath($model) as $key => $objectpp) { if ($objectPropertiespp = $objectpp->objectProperties) { foreach ($objectPropertiespp as $objectPropertypp) { if ($objectPropertypp->property_class != 'private') { $query->orWhere(['object_id' => $objectpp->id]); } } } } } return $this->render('view', ['model' => $model, 'products' => new ActiveDataProvider(['query' => \common\models\CsProducts::find()->where(['object_id' => $model->id])]), 'issues' => new ActiveDataProvider(['query' => \common\models\CsObjectIssues::find()->where(['object_id' => $model->id])]), 'properties' => new ActiveDataProvider(['query' => $query->orderBy('property_type')->groupBy('id')]), 'methods' => new ActiveDataProvider(['query' => \common\models\CsServices::find()->where(['object_id' => $model->id])])]); }
/** * @return \yii\db\ActiveQuery */ public function getIssues() { return $this->hasMany(CsObjectIssues::className(), ['object_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getObjectIssue() { return $this->hasOne(CsObjectIssues::className(), ['id' => 'object_issue_id']); }
/** * Finds the CsObjectIssues model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return CsObjectIssues the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = CsObjectIssues::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }