/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = OrderModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'idUser' => $this->idUser, 'totalPrice' => $this->totalPrice, 'date' => $this->date, 'idPayment' => $this->idPayment, 'idShipping' => $this->idShipping, 'paymentStatus' => $this->paymentStatus]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getIdOrder0() { return $this->hasOne(OrderModel::className(), ['id' => 'idOrder']); }
/** * @return \yii\db\ActiveQuery */ public function getOrders() { return $this->hasMany(OrderModel::className(), ['idShipping' => 'id']); }
/** * Finds the OrderModel model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return OrderModel the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = OrderModel::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getIdOrders() { return $this->hasMany(OrderModel::className(), ['id' => 'idOrder'])->viaTable('{product_list}', ['idProduct' => 'id']); }