Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Doctalk::find();
     $query->with('autor');
     $aProvider = ['query' => $query, 'sort' => ['defaultOrder' => isset($params['sort']) ? $params['sort'] : ['dtlk_id' => SORT_ASC]]];
     $dataProvider = new ActiveDataProvider($aProvider);
     $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;
     }
     $query->andFilterWhere(['dtlk_id' => $this->dtlk_id, 'dtlk_us_id' => $this->dtlk_us_id, 'dtlk_doc_id' => $this->dtlk_doc_id, 'dtlk_created' => $this->dtlk_created]);
     $query->andFilterWhere(['like', 'dtlk_text', $this->dtlk_text]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTalks()
 {
     return $this->hasMany(Doctalk::className(), ['dtlk_doc_id' => 'doc_id']);
 }
Example #3
0
 /**
  * Finds the Doctalk model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Doctalk the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Doctalk::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }