/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Productpricehistories::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['ProductPriceHistoryId' => $this->ProductPriceHistoryId, 'ProductId' => $this->ProductId, 'ProductOptionCombinationId' => $this->ProductOptionCombinationId, 'ProductOptionPriceId' => $this->ProductOptionPriceId, 'OldPrice' => $this->OldPrice, 'NewPrice' => $this->NewPrice, 'created_by' => $this->created_by, 'LastUpdatedBy' => $this->LastUpdatedBy, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'deleted_at' => $this->deleted_at]); $query->andFilterWhere(['like', 'Comment', $this->Comment]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getProductpricehistories() { return $this->hasMany(Productpricehistories::className(), ['ProductOptionPriceId' => 'ProductOptionPriceId']); }
/** * Finds the Productpricehistories model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Productpricehistories the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Productpricehistories::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }