-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProductStock.php
executable file
·92 lines (83 loc) · 2.27 KB
/
ProductStock.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
namespace backend\models\inventory;
use Yii;
use backend\models\master\Product;
use backend\models\master\Warehouse;
use backend\models\master\Cogs;
/**
* This is the model class for table "product_stock".
*
* @property integer $warehouse_id
* @property integer $product_id
* @property integer $qty
* @property integer $created_at
* @property integer $created_by
* @property integer $updated_at
* @property integer $updated_by
*
* @property Product $product
* @property Warehouse $warehouse
*/
class ProductStock extends \yii\db\ActiveRecord
{
public $product_code;
public $product_name;
public $whse_name;
public $artikel;
public $jml;
/**
* @inheritdoc
*/
public static function tableName()
{
return 'product_stock';
}
/**
* @inheritdoc
*/
public function rules()
{
return [
[['warehouse_id', 'product_id', 'qty'], 'required'],
[['warehouse_id', 'product_id', 'qty', 'created_at', 'created_by', 'updated_at', 'updated_by'], 'integer'],
[['product_id'], 'exist', 'skipOnError' => true, 'targetClass' => Product::className(), 'targetAttribute' => ['product_id' => 'id']],
[['warehouse_id'], 'exist', 'skipOnError' => true, 'targetClass' => Warehouse::className(), 'targetAttribute' => ['warehouse_id' => 'id']],
];
}
/**
* @inheritdoc
*/
public function attributeLabels()
{
return [
'warehouse_id' => 'Warehouse ID',
'product_id' => 'Product ID',
'qty' => 'Qty',
'created_at' => 'Created At',
'created_by' => 'Created By',
'updated_at' => 'Updated At',
'updated_by' => 'Updated By',
];
}
/**
* @return \yii\db\ActiveQuery
*/
public function getProduct()
{
return $this->hasOne(Product::className(), ['id' => 'product_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getWarehouse()
{
return $this->hasOne(Warehouse::className(), ['id' => 'warehouse_id']);
}
/**
* @return \yii\db\ActiveQuery
*/
public function getCogs()
{
return $this->hasOne(Cogs::className(), ['product_id' => 'product_id']);
}
}