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