OrderPaymentRecord   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 2
dl 0
loc 50
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A tableName() 0 4 1
A rules() 0 9 1
A attributeLabels() 0 11 1
A behaviors() 0 8 1
1
<?php
2
3
namespace zacksleo\yii2\shop\models;
4
5
use yii\behaviors\TimestampBehavior;
6
7
/**
8
 * This is the model class for table "{{%order_payment_record}}".
9
 *
10
 * @property integer $id
11
 * @property string $order_sn
12
 * @property string $trace_no
13
 * @property string $amount
14
 * @property integer $created_at
15
 * @property integer $updated_at
16
 */
17
class OrderPaymentRecord extends \yii\db\ActiveRecord
18
{
19
    /**
20
     * @inheritdoc
21
     */
22 1
    public static function tableName()
23
    {
24 1
        return '{{%order_payment_record}}';
25
    }
26
27
    /**
28
     * @inheritdoc
29
     */
30 1
    public function rules()
31
    {
32
        return [
33 1
            [['order_sn'], 'required'],
34
            [['amount'], 'number'],
35
            [['created_at', 'updated_at'], 'integer'],
36
            [['order_sn', 'trace_no'], 'string', 'max' => 255],
37
        ];
38
    }
39
40
    /**
41
     * @inheritdoc
42
     */
43 1
    public function attributeLabels()
44
    {
45
        return [
46 1
            'id' => 'ID',
47
            'order_sn' => '订单编号',
48
            'trace_no' => '交易号',
49
            'amount' => '总金额',
50
            'created_at' => '创建时间',
51
            'updated_at' => '更新时间',
52
        ];
53
    }
54
55
    /**
56
     * @inheritdoc
57
     */
58 2
    public function behaviors()
59
    {
60
        return [
61
            'timestamp' => [
62 2
                'class' => TimestampBehavior::className()
0 ignored issues
show
Deprecated Code introduced by
The method yii\base\BaseObject::className() has been deprecated with message: since 2.0.14. On PHP >=5.5, use `::class` instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
63
            ]
64
        ];
65
    }
66
}
67