示例#1
0
 public function search($params)
 {
     $query = ProductModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_product' => $this->id_product, 'id_category' => $this->id_category, 'id_group' => $this->id_group, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'cd_product', $this->cd_product])->andFilterWhere(['like', 'nm_product', $this->nm_product])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]);
     return $dataProvider;
 }
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdProduct()
 {
     return $this->hasOne(Product::className(), ['id_product' => 'id_product']);
 }
示例#3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdProducts()
 {
     return $this->hasMany(Product::className(), ['id_product' => 'id_product'])->viaTable('product_supplier', ['id_supplier' => 'id_supplier']);
 }
示例#4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['id_category' => 'id_category']);
 }
示例#5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdProducts()
 {
     return $this->hasMany(Product::className(), ['id_product' => 'id_product'])->viaTable('transfer_dtl', ['id_transfer' => 'id_transfer']);
 }
 /**
  * Finds the Product model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Product the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Product::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['id_group' => 'id_group']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdProducts()
 {
     return $this->hasMany(Product::className(), ['id_product' => 'id_product'])->viaTable('price', ['id_price_category' => 'id_price_category']);
 }