Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = AttachmentType::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['AttachmentTypeID' => $this->AttachmentTypeID]);
     $query->andFilterWhere(['like', 'AttachmentTypeDescription', $this->AttachmentTypeDescription])->andFilterWhere(['like', 'AttachmentTypePath', $this->AttachmentTypePath]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * Finds the AttachmentType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return AttachmentType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = AttachmentType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAttachmentType()
 {
     return $this->hasOne(AttachmentType::className(), ['AttachmentTypeID' => 'AttachmentTypeID']);
 }