/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = BaseBillableItem::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => array('pageSize' => 10)]);
     $this->load($params);
     if (!$this->validate()) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'status' => $this->status, 'type' => $this->type, 'amount' => $this->amount, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     $query->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getItems()
 {
     return $this->hasMany(BillableItem::className(), ['id' => 'billing_item_id'])->viaTable('billing_payment_item', ['payment_id' => 'id']);
 }
 /**
  * Finds the Account model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  *
  * @param int $id
  *
  * @return Account the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     $id = Uuid::str2uuid($id);
     $billable = BillableItem::findOne($id);
     if ($billable === null) {
         throw new NotFoundHttpException('The requested page does not exist');
     }
     return $billable;
 }