Example #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['id' => 'product_id'])->viaTable('product_stock', ['warehouse_id' => 'id']);
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProduct()
 {
     return $this->hasOne(Product::className(), ['id' => 'product_id']);
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['category_id' => 'id']);
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['supplier_id' => 'id']);
 }
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['product_unit_id' => 'id']);
 }
Example #6
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProducts()
 {
     return $this->hasMany(Product::className(), ['id' => 'product_id'])->viaTable('price', ['price_category_id' => 'id']);
 }
Example #7
0
 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['product_id', 'created_at'], 'required'], [['product_id', 'receipt_id'], 'integer'], [['price'], 'number'], [['created_at', 'updated_at'], 'safe'], [['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'id']], [['receipt_id'], 'exist', 'skipOnError' => true, 'targetClass' => Receipt::className(), 'targetAttribute' => ['receipt_id' => 'id']]];
 }
Example #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSku0()
 {
     return $this->hasOne(Product::className(), ['sku' => 'sku']);
 }