commit | author | age
|
2207d6
|
1 |
<?php |
W |
2 |
|
|
3 |
namespace app\models; |
|
4 |
|
|
5 |
use Yii; |
|
6 |
|
|
7 |
/** |
|
8 |
* This is the model class for table "{{%goods_cat_relation}}". |
|
9 |
* |
|
10 |
* @property int $id |
|
11 |
* @property int $goods_warehouse_id |
|
12 |
* @property int $cat_id |
|
13 |
* @property int $is_delete |
|
14 |
* @property $goods |
|
15 |
*/ |
|
16 |
class GoodsCatRelation extends ModelActiveRecord |
|
17 |
{ |
|
18 |
/** |
|
19 |
* {@inheritdoc} |
|
20 |
*/ |
|
21 |
public static function tableName() |
|
22 |
{ |
|
23 |
return '{{%goods_cat_relation}}'; |
|
24 |
} |
|
25 |
|
|
26 |
/** |
|
27 |
* {@inheritdoc} |
|
28 |
*/ |
|
29 |
public function rules() |
|
30 |
{ |
|
31 |
return [ |
|
32 |
[['id', 'goods_warehouse_id', 'cat_id', 'is_delete'], 'integer'], |
|
33 |
]; |
|
34 |
} |
|
35 |
|
|
36 |
/** |
|
37 |
* {@inheritdoc} |
|
38 |
*/ |
|
39 |
public function attributeLabels() |
|
40 |
{ |
|
41 |
return [ |
|
42 |
'id' => 'ID', |
|
43 |
'goods_warehouse_id' => 'Goods Warhouse ID', |
|
44 |
'cat_id' => 'Cat ID', |
|
45 |
'is_delete' => 'Is Delete', |
|
46 |
]; |
|
47 |
} |
|
48 |
|
|
49 |
public function getGoods() |
|
50 |
{ |
|
51 |
return $this->hasMany(Goods::className(), ['goods_warehouse_id' => 'goods_warehouse_id']) |
|
52 |
->andWhere(['is_delete' => 0]); |
|
53 |
} |
|
54 |
} |