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". |
11
|
|
|
* |
12
|
|
|
* @property integer $id |
13
|
|
|
* @property string $created |
14
|
|
|
* @property string $updated |
15
|
|
|
* @property string $name |
16
|
|
|
* @property string $extension |
17
|
|
|
* @property string $mime_type |
18
|
|
|
* @property resource $content |
19
|
|
|
* @property string $md5 |
20
|
|
|
* @property string $import_files_source_id |
21
|
|
|
* @property string $use_id |
22
|
|
|
* @property string $import_files_statuse_id |
23
|
|
|
* @property string $import_setting_id |
24
|
|
|
* @property integer $rows_count |
25
|
|
|
* @property integer $rows_errors |
26
|
|
|
* @property integer $rows_success |
27
|
|
|
* @property string $start_date |
28
|
|
|
* @property string $end_date |
29
|
|
|
* |
30
|
|
|
* @property \execut\import\models\FilesSource $importFilesSource |
31
|
|
|
* @property \execut\import\models\FilesStatuse $importFilesStatuse |
32
|
|
|
* @property \execut\import\models\Setting $importSetting |
33
|
|
|
* @property \execut\import\models\User $use |
34
|
|
|
* @property \execut\import\models\Log[] logs |
35
|
|
|
*/ |
36
|
|
|
class File extends ActiveRecord |
37
|
|
|
{ |
38
|
|
|
/** |
39
|
|
|
* @inheritdoc |
40
|
|
|
*/ |
41
|
|
|
public static function tableName() |
42
|
|
|
{ |
43
|
|
|
return 'import_files'; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @inheritdoc |
48
|
|
|
*/ |
49
|
|
|
public function rules() |
50
|
|
|
{ |
51
|
|
|
return ArrayHelper::merge(parent::rules(), [ |
52
|
|
|
[['created', 'updated', 'start_date', 'end_date'], 'safe'], |
53
|
|
|
[['name', 'extension', 'mime_type', 'content', 'md5', 'import_files_source_id', 'import_files_statuse_id', 'import_setting_id'], 'required'], |
54
|
|
|
'content' => [['content'], 'string'], |
55
|
|
|
[['import_files_source_id', 'use_id', 'import_files_statuse_id', 'import_setting_id', 'rows_count', 'rows_errors', 'rows_success'], 'integer'], |
56
|
|
|
[['name', 'extension', 'mime_type'], 'string', 'max' => 255], |
57
|
|
|
[['md5'], 'string', 'max' => 64], |
58
|
|
|
[['import_files_source_id'], 'exist', 'skipOnError' => true, 'targetClass' => FilesSource::class, 'targetAttribute' => ['import_files_source_id' => 'id']], |
59
|
|
|
[['import_files_statuse_id'], 'exist', 'skipOnError' => true, 'targetClass' => FilesStatuse::class, 'targetAttribute' => ['import_files_statuse_id' => 'id']], |
60
|
|
|
[['import_setting_id'], 'exist', 'skipOnError' => true, 'targetClass' => Setting::class, 'targetAttribute' => ['import_setting_id' => 'id']], |
61
|
|
|
[['use_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::class, 'targetAttribute' => ['use_id' => 'id']], |
62
|
|
|
]); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @return \yii\db\ActiveQuery |
67
|
|
|
*/ |
68
|
|
|
public function getSource() |
69
|
|
|
{ |
70
|
|
|
return $this->hasOne(\execut\import\models\FilesSource::class, ['id' => 'import_files_source_id'])->inverseOf('files'); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @return \yii\db\ActiveQuery |
75
|
|
|
*/ |
76
|
|
|
public function getStatuse() |
77
|
|
|
{ |
78
|
|
|
return $this->hasOne(\execut\import\models\FilesStatuse::class, ['id' => 'import_files_statuse_id'])->inverseOf('files'); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return \yii\db\ActiveQuery |
83
|
|
|
*/ |
84
|
|
|
public function getSetting() |
85
|
|
|
{ |
86
|
|
|
return $this->hasOne(\execut\import\models\Setting::class, ['id' => 'import_setting_id'])->inverseOf('files'); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return \yii\db\ActiveQuery |
91
|
|
|
*/ |
92
|
|
|
public function getUse() |
93
|
|
|
{ |
94
|
|
|
return $this->hasOne(\execut\import\models\User::class, ['id' => 'use_id'])->inverseOf('files'); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* @return \yii\db\ActiveQuery |
99
|
|
|
*/ |
100
|
|
|
public function getLogs() |
101
|
|
|
{ |
102
|
|
|
return $this->hasMany(\execut\import\models\Log::class, ['import_file_id' => 'id'])->inverseOf('file'); |
103
|
|
|
} |
104
|
|
|
} |
105
|
|
|
|