コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Regulations::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]], 'pagination' => ['pageSize' => 50]]);
     $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(['id' => $this->id, 'subcat_id' => $this->subcat_id, 'created' => $this->created, 'updated' => $this->updated, 'is_active' => 1]);
     $query->andFilterWhere(['like', 'name', $this->globalSearch])->orFilterWhere(['like', 'description', $this->globalSearch]);
     return $dataProvider;
 }
コード例 #2
0
 /**
  * Finds the Regulations model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Regulations the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Regulations::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
コード例 #3
0
ファイル: AdmMenuItems.php プロジェクト: phprocks/normativos
 public function getRegulations()
 {
     return $this->hasMany(Regulations::className(), ['subcat_id' => 'id']);
 }
コード例 #4
0
ファイル: Attachments.php プロジェクト: phprocks/normativos
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getRegulations()
 {
     return $this->hasOne(Regulations::className(), ['id' => 'regulations_id']);
 }