public function search($params) { $query = ProductSupplierModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id_product' => $this->id_product, 'id_supplier' => $this->id_supplier, 'create_by' => $this->create_by, 'update_by' => $this->update_by]); $query->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getProductSupplier() { return $this->hasOne(ProductSupplier::className(), ['id_supplier' => 'id_supplier']); }
/** * Finds the ProductSupplier model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id_product * @param integer $id_supplier * @return ProductSupplier the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id_product, $id_supplier) { if (($model = ProductSupplier::findOne(['id_product' => $id_product, 'id_supplier' => $id_supplier])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }