/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = OrderPreparation::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'create_uid' => $this->create_uid, 'create_date' => $this->create_date, 'write_date' => $this->write_date, 'write_uid' => $this->write_uid, 'partner_shipping_id' => $this->partner_shipping_id, 'sale_id' => $this->sale_id, 'duedate' => $this->duedate, 'tanggal' => $this->tanggal, 'picking_id' => $this->picking_id, 'partner_id' => $this->partner_id]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'note', $this->note])->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'poc', $this->poc])->andFilterWhere(['like', 'terms', $this->terms]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getPrepare() { return $this->hasOne(OrderPreparation::className(), ['id' => 'prepare_id']); }
/** * Finds the OrderPreparation model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return OrderPreparation the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = OrderPreparation::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getOrderPreparations() { return $this->hasMany(OrderPreparation::className(), ['partner_id' => 'id']); }