Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = PostType::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['PostTypeID' => $this->PostTypeID]);
     $query->andFilterWhere(['like', 'PostTypeDescription', $this->PostTypeDescription]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * Finds the PostType model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PostType the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PostType::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPostType()
 {
     return $this->hasOne(PostType::className(), ['PostTypeID' => 'PostTypeID']);
 }
Пример #4
0
 /**
  * Create a post type object
  * @return PostType
  */
 public function create($input)
 {
     return PostType::create($input);
 }