Completed
Push — master ( 191664...7b2c3c )
by zacksleo
03:29
created

ShippingAddress   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 42
rs 10
c 1
b 0
f 1
ccs 0
cts 28
cp 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A tableName() 0 4 1
A rules() 0 9 1
A attributeLabels() 0 15 1
1
<?php
2
3
namespace zacksleo\yii2\shop\models;
4
5
use Yii;
6
7
/**
8
 * This is the model class for table "mops_shipping_address".
9
 *
10
 * @property integer $id
11
 * @property integer $user_id
12
 * @property string $phone
13
 * @property string $name
14
 * @property string $street
15
 * @property string $postcode
16
 * @property string $district
17
 * @property string $city
18
 * @property string $province
19
 * @property string $country
20
 */
21
class ShippingAddress extends \yii\db\ActiveRecord
22
{
23
    /**
24
     * @inheritdoc
25
     */
26
    public static function tableName()
27
    {
28
        return '{{%shipping_address}}';
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function rules()
35
    {
36
        return [
37
            [['user_id', 'phone', 'name', 'street', 'district', 'city', 'province'], 'required'],
38
            [['user_id'], 'integer'],
39
            [['phone', 'name', 'street', 'district', 'city', 'province', 'country'], 'string', 'max' => 255],
40
            [['postcode'], 'string', 'max' => 10],
41
        ];
42
    }
43
44
    /**
45
     * @inheritdoc
46
     */
47
    public function attributeLabels()
48
    {
49
        return [
50
            'id' => 'ID',
51
            'user_id' => '用户',
52
            'phone' => '电话',
53
            'name' => '姓名',
54
            'street' => '街道',
55
            'postcode' => '邮编',
56
            'district' => '区',
57
            'city' => '市',
58
            'province' => '省',
59
            'country' => '国家',
60
        ];
61
    }
62
}
63