Completed
Pull Request — master (#4)
by
unknown
01:44 queued 35s
created

FileUploadSession   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 84.62%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 28
ccs 11
cts 13
cp 0.8462
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A behaviors() 0 16 1
A tableName() 0 4 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\behaviors\TimestampBehavior;
11
use yii\db\Expression;
12
13
/**
14
 * Class FileUploadSession
15
 * @package rkit\filemanager\models
16
 *
17
 * @property int $id
18
 * @property int $file_id
19
 * @property int $created_user_id
20
 * @property string $created_on
21
 * @property string $target_model_class
22
 * @property string $target_model_id
23
 * @property string $target_model_attribute
24
 */
25
class FileUploadSession  extends \yii\db\ActiveRecord
26
{
27
28
    /**
29
     * @inheritdoc
30
     */
31
    public static function tableName()
32
    {
33
        return '{{%file_upload_session}}';
34
    }
35
36 25
    public function behaviors()
37
    {
38
        return [
39
            [
40 25
                'class' => BlameableBehavior::class,
41 25
                'createdByAttribute' => 'created_user_id',
42 25
                'updatedByAttribute' => false,
43 25
            ],
44
            [
45 25
                'class' => TimestampBehavior::class,
46 25
                'createdAtAttribute' => 'created_on',
47 25
                'updatedAtAttribute' => false,
48 25
                'value' => new Expression('NOW()'),
49 25
            ],
50 25
        ];
51
    }
52
}
53