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_coupon_relation}}". |
|
9 |
* |
|
10 |
* @property int $id |
|
11 |
* @property int $goods_id |
|
12 |
* @property int $coupon_id |
|
13 |
* @property int $num |
|
14 |
* @property int $is_delete |
|
15 |
* @property Coupon $goodsCoupons |
|
16 |
*/ |
|
17 |
class GoodsCouponRelation extends ModelActiveRecord |
|
18 |
{ |
|
19 |
/** |
|
20 |
* {@inheritdoc} |
|
21 |
*/ |
|
22 |
public static function tableName() |
|
23 |
{ |
|
24 |
return '{{%goods_coupon_relation}}'; |
|
25 |
} |
|
26 |
|
|
27 |
/** |
|
28 |
* {@inheritdoc} |
|
29 |
*/ |
|
30 |
public function rules() |
|
31 |
{ |
|
32 |
return [ |
|
33 |
[['goods_id', 'coupon_id'], 'required'], |
|
34 |
[['goods_id', 'coupon_id', 'num', 'is_delete'], 'integer'], |
|
35 |
]; |
|
36 |
} |
|
37 |
|
|
38 |
/** |
|
39 |
* {@inheritdoc} |
|
40 |
*/ |
|
41 |
public function attributeLabels() |
|
42 |
{ |
|
43 |
return [ |
|
44 |
'id' => 'ID', |
|
45 |
'goods_id' => 'Goods ID', |
|
46 |
'coupon_id' => 'Coupon ID', |
|
47 |
'num' => 'Num', |
|
48 |
'is_delete' => 'Is Delete', |
|
49 |
]; |
|
50 |
} |
|
51 |
|
|
52 |
public function getGoodsCoupons() |
|
53 |
{ |
|
54 |
return $this->hasOne(Coupon::className(), ['id' => 'coupon_id']); |
|
55 |
} |
|
56 |
} |