Completed
Pull Request — master (#4)
by
unknown
03:14
created

FileUploadSession::behaviors()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 4
cts 4
cp 1
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * Alphatech, <http://www.alphatech.com.ua>
4
 *
5
 * Copyright (C) 2018-present Sergii Webkadabra <[email protected]>
6
 */
7
8
namespace rkit\filemanager\models;
9
use yii\behaviors\BlameableBehavior;
10
use yii\db\Expression;
11
12
/**
13
 * Class FileUploadSession
14
 * @package rkit\filemanager\models
15
 *
16
 * @property int $id
17
 * @property int $file_id
18
 * @property int $created_user_id
19
 * @property string $created_on
20
 * @property string $target_model_class
21
 * @property string $target_model_id
22
 * @property string $target_model_attribute
23
 */
24
class FileUploadSession  extends \yii\db\ActiveRecord
25
{
26
27
    /**
28
     * @inheritdoc
29
     */
30 1
    public static function tableName()
31
    {
32 1
        return '{{%file_upload_session}}';
33
    }
34
35 25
    public function behaviors()
36
    {
37
        return [
38
            [
39 25
                'class' => BlameableBehavior::class,
40
                'createdByAttribute' => 'created_user_id',
41
                'updatedByAttribute' => false,
42
            ],
43
            [
44
                'class' => TimestampBehavior::class,
45 25
                'createdAtAttribute' => 'created_on',
46 25
                'value' => new Expression('NOW()'),
47
            ],
48
        ];
49
    }
50
}
51