OrderPaymentRecord::rules()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 9
ccs 2
cts 2
cp 1
rs 9.9666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 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