FilesSource   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 8
dl 0
loc 36
rs 10
c 1
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getSettings() 0 3 1
A tableName() 0 3 1
A rules() 0 6 1
A getFiles() 0 3 1
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_files_sources".
11
 *
12
 * @property integer $id
13
 * @property string $created
14
 * @property string $updated
15
 * @property string $name
16
 * @property string $key
17
 *
18
 * @property \execut\import\models\File[] $importFiles
19
 * @property \execut\import\models\Setting[] $importSettings
20
 */
21
class FilesSource extends ActiveRecord
22
{
23
    /**
24
     * @inheritdoc
25
     */
26
    public static function tableName()
27
    {
28
        return 'import_files_sources';
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function rules()
35
    {
36
        return ArrayHelper::merge(parent::rules(), [
37
            [['created', 'updated'], 'safe'],
38
            [['name', 'key'], 'required'],
39
            [['name', 'key'], 'string', 'max' => 255],
40
        ]);
41
    }
42
43
    /**
44
     * @return \yii\db\ActiveQuery
45
     */
46
    public function getFiles()
47
    {
48
        return $this->hasMany(\execut\import\models\File::class, ['import_files_source_id' => 'id'])->inverseOf('filesSource');
49
    }
50
51
    /**
52
     * @return \yii\db\ActiveQuery
53
     */
54
    public function getSettings()
55
    {
56
        return $this->hasMany(\execut\import\models\Setting::class, ['import_files_source_id' => 'id'])->inverseOf('filesSource');
57
    }
58
}
59