Log::getSettingsValue()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace execut\import\models\base;
4
5
use Yii;
6
use yii\db\ActiveRecord;
7
use yii\helpers\ArrayHelper;
8
9
/**
10
 * This is the model class for table "import_logs".
11
 *
12
 * @property integer $id
13
 * @property string $created
14
 * @property string $updated
15
 * @property integer $level
16
 * @property string $category
17
 * @property string $prefix
18
 * @property string $message
19
 * @property integer $row_nbr
20
 * @property integer $column_nbr
21
 * @property string $value
22
 * @property string $import_file_id
23
 * @property string $import_settings_value_id
24
 *
25
 * @property \execut\import\models\File $importFile
26
 * @property \execut\import\models\SettingsValue $importSettingsValue
27
 */
28
class Log extends ActiveRecord
29
{
30
    /**
31
     * @inheritdoc
32
     */
33
    public static function tableName()
34
    {
35
        return 'import_logs';
36
    }
37
38
    /**
39
     * @inheritdoc
40
     */
41
    public function rules()
42
    {
43
        return ArrayHelper::merge(parent::rules(), [
44
            [['created', 'updated'], 'safe'],
45
            [['level', 'category', 'import_file_id'], 'required'],
46
            [['level', 'row_nbr', 'column_nbr', 'import_file_id', 'import_settings_value_id'], 'integer'],
47
            [['message'], 'string'],
48
            [['category', 'prefix', 'value'], 'string', 'max' => 255],
49
            [['import_file_id'], 'exist', 'skipOnError' => true, 'targetClass' => File::class, 'targetAttribute' => ['import_file_id' => 'id']],
50
            [['import_settings_value_id'], 'exist', 'skipOnError' => true, 'targetClass' => SettingsValue::class, 'targetAttribute' => ['import_settings_value_id' => 'id']],
51
        ]);
52
    }
53
54
    /**
55
     * @return \yii\db\ActiveQuery
56
     */
57
    public function getFile()
58
    {
59
        return $this->hasOne(\execut\import\models\File::class, ['id' => 'import_file_id'])->inverseOf('logs');
60
    }
61
62
    /**
63
     * @return \yii\db\ActiveQuery
64
     */
65
    public function getSettingsValue()
66
    {
67
        return $this->hasOne(\execut\import\models\SettingsValue::class, ['id' => 'import_settings_value_id'])->inverseOf('logs');
68
    }
69
}
70